123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.CommonLogic;
- using EMIS.CommonLogic.CultureplanManage.PlanManagement;
- using EMIS.DataLogic.CultureplanManage.PlanManagement;
- using EMIS.CommonLogic.Students;
- using Bowin.Common.Utility;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.CultureplanManage.PlanManagement;
- using EMIS.ViewModel;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using System.Transactions;
- using EMIS.ViewModel.CultureplanManage;
- using EMIS.ViewModel.Students;
- using System.Text.RegularExpressions;
- using EMIS.Utility;
- namespace EMIS.ExtensionLogic.ServiceLogic.CultureplanManage.PlanManagement
- {
- public class SpecialtyPlanServices : EMIS.CommonLogic.CultureplanManage.PlanManagement.SpecialtyPlanServices
- {
- /// <summary>
- /// 编辑(新增、修改,业务主键:学年学期ID、年级专业ID、课程信息ID、开课教研室(2020.11.17梁剑提出))
- /// 注:刷新相关的执行计划信息
- /// </summary>
- /// <param name="specialtyPlanView"></param>
- public override void SpecialtyPlanEdit(SpecialtyPlanView specialtyPlanView)
- {
- try
- {
- //查询对应的年级专业信息
- var grademajor = SpecialtyPlanDAL.GrademajorRepository
- .GetList(x => x.GrademajorID == specialtyPlanView.GrademajorID).SingleOrDefault();
- if (grademajor == null)
- {
- throw new Exception("年级专业信息不存在,请检查。");
- }
- //查询年级专业对应的入学学年学期信息
- var startSchoolyear = SpecialtyPlanDAL.SchoolyearRepository.GetList(x => x.Years == grademajor.GradeID
- && x.SchoolcodeID == grademajor.SemesterID).SingleOrDefault();
- if (startSchoolyear == null)
- {
- throw new Exception("年级专业对应的入学学年学期信息不存在,请检查。");
- }
- //查询年级专业对应的毕业学年学期信息
- var graduatingSemester = SpecialtyPlanDAL.SchoolyearRepository
- .GetList(x => x.SchoolyearID == grademajor.GraduateSchoolyearID).SingleOrDefault();
- if (graduatingSemester == null)
- {
- throw new Exception("年级专业对应的毕业学年学期信息不存在,请检查。");
- }
- //查询对应的学年学期信息
- var schoolyear = SpecialtyPlanDAL.SchoolyearRepository
- .GetList(x => x.SchoolyearID == specialtyPlanView.SchoolyearID).SingleOrDefault();
- if (schoolyear == null)
- {
- throw new Exception("学年学期信息不存在,请检查。");
- }
- if (schoolyear.Value < startSchoolyear.Value)
- {
- throw new Exception("学年学期小于入学学年学期,请检查。");
- }
- if (schoolyear.Value > graduatingSemester.Value)
- {
- throw new Exception("学年学期大于毕业学年学期,请检查。");
- }
- //查询数据库进行验证
- var specialtyPlanVerify = SpecialtyPlanDAL.SpecialtyPlanRepository
- .GetList(x => x.SpecialtyPlanID != specialtyPlanView.SpecialtyPlanID
- && x.SchoolyearID == specialtyPlanView.SchoolyearID
- && x.GrademajorID == specialtyPlanView.GrademajorID
- && x.CoursematerialID == specialtyPlanView.CoursematerialID
- && x.DepartmentID == specialtyPlanView.DepartmentID).SingleOrDefault();
- if (specialtyPlanVerify == null)
- {
- List<EM_SpecialtyPlan> newSpecialtyPlanInList = new List<EM_SpecialtyPlan>();
- List<EM_SpecialtyPlan> newSpecialtyPlanUpList = new List<EM_SpecialtyPlan>();
- List<EM_SpecialtyPlanTeachingSetting> newSPTeachingSettingInList = new List<EM_SpecialtyPlanTeachingSetting>();
- List<EM_SpecialtyPlanTeachingSetting> newSPTeachingSettingUpList = new List<EM_SpecialtyPlanTeachingSetting>();
- List<EM_SpecialtyPlanTeachingModeType> newSPTeachingModeTypeInList = new List<EM_SpecialtyPlanTeachingModeType>();
- List<EM_SpecialtyPlanTeachingPlace> newSPTeachingPlaceInList = new List<EM_SpecialtyPlanTeachingPlace>();
- List<Guid?> specialtyPlanTMDelList = new List<Guid?>();
- List<Guid?> specialtyPlanTPDelList = new List<Guid?>();
- List<EM_ExecutablePlan> newExecutablePlanUpList = new List<EM_ExecutablePlan>();
- List<EM_ExecutablePlanProfile> newProfileInList = new List<EM_ExecutablePlanProfile>();
- List<EM_ExecutablePlanProfile> newProfileUpList = new List<EM_ExecutablePlanProfile>();
- List<EM_ExecutablePlanTeachingSetting> newEPTeachingSettingInList = new List<EM_ExecutablePlanTeachingSetting>();
- List<EM_ExecutablePlanTeachingSetting> newEPTeachingSettingUpList = new List<EM_ExecutablePlanTeachingSetting>();
- List<EM_ExecutablePlanTeachingModeType> newEPTeachingModeTypeInList = new List<EM_ExecutablePlanTeachingModeType>();
- List<EM_ExecutablePlanTeachingPlace> newEPTeachingPlaceInList = new List<EM_ExecutablePlanTeachingPlace>();
- List<Guid?> executablePlanTMDelList = new List<Guid?>();
- List<Guid?> executablePlanTPDelList = new List<Guid?>();
- List<Guid> executablePlanIDList = new List<Guid>();
- //数据有误验证
- if (specialtyPlanView.SpecialtyPlanID != Guid.Empty)
- {
- var specialtyPlan = SpecialtyPlanDAL.SpecialtyPlanRepository
- .GetList(x => x.SpecialtyPlanID == specialtyPlanView.SpecialtyPlanID,
- (x => x.EM_SpecialtyPlanTeachingSetting), (x => x.EM_ExecutablePlan)).SingleOrDefault();
- if (specialtyPlan == null)
- {
- throw new Exception("数据有误,请核查。");
- }
- else
- {
- //表示修改
- specialtyPlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- specialtyPlan.GrademajorID = specialtyPlanView.GrademajorID;
- specialtyPlan.CoursematerialID = specialtyPlanView.CoursematerialID;
- specialtyPlan.CourseStructureID = specialtyPlanView.CourseStructureID;
- specialtyPlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
- specialtyPlan.CourseTypeID = specialtyPlanView.CourseTypeID;
- specialtyPlan.CourseQualityID = specialtyPlanView.CourseQualityID;
- specialtyPlan.DepartmentID = specialtyPlanView.DepartmentID;
- specialtyPlan.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- specialtyPlan.IsCooperation = specialtyPlanView.IsCooperation;
- specialtyPlan.IsRequired = specialtyPlanView.IsRequired;
- specialtyPlan.IsElective = specialtyPlanView.IsElective;
- specialtyPlan.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- specialtyPlan.IsMainCourse = specialtyPlanView.IsMainCourse;
- specialtyPlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
- specialtyPlan.CourseFineID = specialtyPlanView.CourseFineID;
- specialtyPlan.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- specialtyPlan.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- specialtyPlan.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- specialtyPlan.ResultTypeID = specialtyPlanView.ResultTypeID;
- specialtyPlan.HandleModeID = specialtyPlanView.HandleModeID;
- specialtyPlan.Remark = specialtyPlanView.Remark;
- SetModifyStatus(specialtyPlan);
- newSpecialtyPlanUpList.Add(specialtyPlan);
- if (specialtyPlan.EM_SpecialtyPlanTeachingSetting == null)
- {
- var newSPTeachingSetting = new EM_SpecialtyPlanTeachingSetting();
- newSPTeachingSetting.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- newSPTeachingSetting.Credit = specialtyPlanView.Credit;
- newSPTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- newSPTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- newSPTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- newSPTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- newSPTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- newSPTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- newSPTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- newSPTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- newSPTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- newSPTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- newSPTeachingSettingInList.Add(newSPTeachingSetting);
- }
- else
- {
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.Credit = specialtyPlanView.Credit;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- newSPTeachingSettingUpList.Add(specialtyPlan.EM_SpecialtyPlanTeachingSetting);
- }
- if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- specialtyPlanTMDelList.Add(specialtyPlan.SpecialtyPlanID);
- foreach (var teachingModeID in specialtyPlanView.TeachingModeIDList)
- {
- var newSPTeachingMode = new EM_SpecialtyPlanTeachingModeType();
- newSPTeachingMode.SpecialtyPlanTeachingModeTypeID = Guid.NewGuid();
- newSPTeachingMode.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- newSPTeachingMode.TeachingModeID = teachingModeID;
- SetNewStatus(newSPTeachingMode);
- newSPTeachingModeTypeInList.Add(newSPTeachingMode);
- }
- }
- else
- {
- specialtyPlanTMDelList.Add(specialtyPlan.SpecialtyPlanID);
- }
- if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- specialtyPlanTPDelList.Add(specialtyPlan.SpecialtyPlanID);
- foreach (var teachingPlaceID in specialtyPlanView.TeachingPlaceIDList)
- {
- var newSPTeachingPlace = new EM_SpecialtyPlanTeachingPlace();
- newSPTeachingPlace.SpecialtyPlanTeachingPlaceID = Guid.NewGuid();
- newSPTeachingPlace.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- newSPTeachingPlace.TeachingPlace = teachingPlaceID;
- SetNewStatus(newSPTeachingPlace);
- newSPTeachingPlaceInList.Add(newSPTeachingPlace);
- }
- }
- else
- {
- specialtyPlanTPDelList.Add(specialtyPlan.SpecialtyPlanID);
- }
- //对应的执行计划信息更新(根据业务主键:学年学期ID、年级专业ID、课程信息ID)
- //注:由于相关业务主键冗余且同时存在主外键关联,目前不允许修改相关业务主键
- var executablePlan = SpecialtyPlanDAL.ExecutablePlanRepository.GetList(x => x.SchoolyearID == specialtyPlanView.SchoolyearID
- && x.GrademajorID == specialtyPlanView.GrademajorID
- && x.CoursematerialID == specialtyPlanView.CoursematerialID,
- (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).SingleOrDefault();
- if (executablePlan == null)
- {
- //表示不存在对应的执行计划信息(暂不新增)
- }
- else
- {
- //表示存在对应的执行计划信息(修改)
- executablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
- //暂不考虑
- //executablePlan.DefaultClassName = specialtyPlanView.CourseName + "-" + specialtyPlanView.GrademajorName;
- executablePlan.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- executablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- executablePlan.GrademajorID = specialtyPlanView.GrademajorID;
- executablePlan.CoursematerialID = specialtyPlanView.CoursematerialID;
- executablePlan.CourseStructureID = specialtyPlanView.CourseStructureID;
- executablePlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
- executablePlan.CourseTypeID = specialtyPlanView.CourseTypeID;
- executablePlan.CourseQualityID = specialtyPlanView.CourseQualityID;
- executablePlan.DepartmentID = specialtyPlanView.DepartmentID;
- executablePlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
- executablePlan.ResultTypeID = specialtyPlanView.ResultTypeID;
- executablePlan.HandleModeID = specialtyPlanView.HandleModeID;
- SetModifyStatus(executablePlan);
- newExecutablePlanUpList.Add(executablePlan);
- if (executablePlan.EM_ExecutablePlanProfile == null)
- {
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- newProfile.IsCooperation = specialtyPlanView.IsCooperation;
- newProfile.IsRequired = specialtyPlanView.IsRequired;
- newProfile.IsElective = specialtyPlanView.IsElective;
- newProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- newProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
- newProfile.CourseFineID = specialtyPlanView.CourseFineID;
- newProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- }
- else
- {
- executablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- executablePlan.EM_ExecutablePlanProfile.IsCooperation = specialtyPlanView.IsCooperation;
- executablePlan.EM_ExecutablePlanProfile.IsRequired = specialtyPlanView.IsRequired;
- executablePlan.EM_ExecutablePlanProfile.IsElective = specialtyPlanView.IsElective;
- executablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- executablePlan.EM_ExecutablePlanProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
- executablePlan.EM_ExecutablePlanProfile.CourseFineID = specialtyPlanView.CourseFineID;
- executablePlan.EM_ExecutablePlanProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- executablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- executablePlan.EM_ExecutablePlanProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- SetModifyStatus(executablePlan.EM_ExecutablePlanProfile);
- newProfileUpList.Add(executablePlan.EM_ExecutablePlanProfile);
- }
- if (executablePlan.EM_ExecutablePlanTeachingSetting == null)
- {
- var newEPTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newEPTeachingSetting.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingSetting.Credit = specialtyPlanView.Credit;
- newEPTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- newEPTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- newEPTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- newEPTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- newEPTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- newEPTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- newEPTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- newEPTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- newEPTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- newEPTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- newEPTeachingSettingInList.Add(newEPTeachingSetting);
- }
- else
- {
- //可更新的相关信息
- executablePlan.EM_ExecutablePlanTeachingSetting.Credit = specialtyPlanView.Credit;
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- executablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- executablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- }
- newEPTeachingSettingUpList.Add(executablePlan.EM_ExecutablePlanTeachingSetting);
- }
- if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- //可更新的相关信息
- if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newModeType in specialtyPlanView.TeachingModeIDList.ToList())
- {
- var newEPTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newEPTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newEPTeachingModeType.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newEPTeachingModeType);
- newEPTeachingModeTypeInList.Add(newEPTeachingModeType);
- }
- }
- else
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- }
- }
- if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newPlace in specialtyPlanView.TeachingPlaceIDList.ToList())
- {
- var newEPTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newEPTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newEPTeachingPlace.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newEPTeachingPlace);
- newEPTeachingPlaceInList.Add(newEPTeachingPlace);
- }
- }
- else
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- }
- executablePlanIDList.Add(executablePlan.ExecutablePlanID);
- }
- //存在对应的主外键关联
- if (specialtyPlan.EM_ExecutablePlan.Count() > 0)
- {
- //根据专业计划主键ID查询对应的执行计划信息List
- var newExecutablePlanList = SpecialtyPlanDAL.ExecutablePlanRepository
- .GetList(x => x.SpecialtyPlanID == specialtyPlan.SpecialtyPlanID,
- (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).ToList();
- foreach (var newExecutablePlan in newExecutablePlanList)
- {
- if (!executablePlanIDList.Contains(newExecutablePlan.ExecutablePlanID))
- {
- //查询对应的专业计划信息(业务主键:学年学期ID、年级专业ID、课程信息ID)
- var newSpecialtyPlanView = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(x => x.SpecialtyPlanID != specialtyPlan.SpecialtyPlanID
- && x.SchoolyearID == newExecutablePlan.SchoolyearID
- && x.GrademajorID == newExecutablePlan.GrademajorID
- && x.CoursematerialID == newExecutablePlan.CoursematerialID).SingleOrDefault();
- if (newSpecialtyPlanView == null)
- {
- newExecutablePlan.SpecialtyPlanID = null;
- SetModifyStatus(newExecutablePlan);
- newExecutablePlanUpList.Add(newExecutablePlan);
- }
- else
- {
- //来源专业计划默认为必修课
- newExecutablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
- newExecutablePlan.DefaultClassName = newSpecialtyPlanView.CourseName + "-" + newSpecialtyPlanView.GrademajorName;
- newExecutablePlan.SpecialtyPlanID = newSpecialtyPlanView.SpecialtyPlanID;
- newExecutablePlan.SchoolyearID = newSpecialtyPlanView.SchoolyearID;
- newExecutablePlan.GrademajorID = newSpecialtyPlanView.GrademajorID;
- newExecutablePlan.CoursematerialID = newSpecialtyPlanView.CoursematerialID;
- newExecutablePlan.CourseStructureID = newSpecialtyPlanView.CourseStructureID;
- newExecutablePlan.CourseCategoryID = newSpecialtyPlanView.CourseCategoryID;
- newExecutablePlan.CourseTypeID = newSpecialtyPlanView.CourseTypeID;
- newExecutablePlan.CourseQualityID = newSpecialtyPlanView.CourseQualityID;
- newExecutablePlan.DepartmentID = newSpecialtyPlanView.DepartmentID;
- newExecutablePlan.IsNeedMaterial = newSpecialtyPlanView.IsNeedMaterial;
- newExecutablePlan.ResultTypeID = newSpecialtyPlanView.ResultTypeID;
- newExecutablePlan.HandleModeID = newSpecialtyPlanView.HandleModeID;
- SetModifyStatus(newExecutablePlan);
- newExecutablePlanUpList.Add(newExecutablePlan);
- if (newExecutablePlan.EM_ExecutablePlanProfile == null)
- {
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = newSpecialtyPlanView.IsSpecialtycore;
- newProfile.IsCooperation = newSpecialtyPlanView.IsCooperation;
- newProfile.IsRequired = newSpecialtyPlanView.IsRequired;
- newProfile.IsElective = newSpecialtyPlanView.IsElective;
- newProfile.IsNetworkCourse = newSpecialtyPlanView.IsNetworkCourse;
- newProfile.IsMainCourse = newSpecialtyPlanView.IsMainCourse;
- newProfile.CourseFineID = newSpecialtyPlanView.CourseFineID;
- newProfile.PracticeTypeID = newSpecialtyPlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = newSpecialtyPlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = newSpecialtyPlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- }
- else
- {
- newExecutablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = newSpecialtyPlanView.IsSpecialtycore;
- newExecutablePlan.EM_ExecutablePlanProfile.IsCooperation = newSpecialtyPlanView.IsCooperation;
- newExecutablePlan.EM_ExecutablePlanProfile.IsRequired = newSpecialtyPlanView.IsRequired;
- newExecutablePlan.EM_ExecutablePlanProfile.IsElective = newSpecialtyPlanView.IsElective;
- newExecutablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = newSpecialtyPlanView.IsNetworkCourse;
- newExecutablePlan.EM_ExecutablePlanProfile.IsMainCourse = newSpecialtyPlanView.IsMainCourse;
- newExecutablePlan.EM_ExecutablePlanProfile.CourseFineID = newSpecialtyPlanView.CourseFineID;
- newExecutablePlan.EM_ExecutablePlanProfile.PracticeTypeID = newSpecialtyPlanView.PracticeTypeID;
- newExecutablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = newSpecialtyPlanView.TeachinglanguageID;
- newExecutablePlan.EM_ExecutablePlanProfile.ExaminationModeID = newSpecialtyPlanView.ExaminationModeID;
- SetModifyStatus(newExecutablePlan.EM_ExecutablePlanProfile);
- newProfileUpList.Add(newExecutablePlan.EM_ExecutablePlanProfile);
- }
- if (newExecutablePlan.EM_ExecutablePlanTeachingSetting == null)
- {
- var newEPTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newEPTeachingSetting.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newEPTeachingSetting.Credit = newSpecialtyPlanView.Credit;
- newEPTeachingSetting.TheoryCourse = newSpecialtyPlanView.TheoryCourse;
- newEPTeachingSetting.Practicehours = newSpecialtyPlanView.Practicehours;
- newEPTeachingSetting.Trialhours = newSpecialtyPlanView.Trialhours;
- newEPTeachingSetting.TheoryWeeklyNum = newSpecialtyPlanView.TheoryWeeklyNum;
- newEPTeachingSetting.PracticeWeeklyNum = newSpecialtyPlanView.PracticeWeeklyNum;
- newEPTeachingSetting.TrialWeeklyNum = newSpecialtyPlanView.TrialWeeklyNum;
- newEPTeachingSetting.WeeklyHours = newSpecialtyPlanView.WeeklyHours;
- newEPTeachingSetting.WeeklyNum = newSpecialtyPlanView.WeeklyNum;
- newEPTeachingSetting.StartWeeklyNum = newSpecialtyPlanView.StartWeeklyNum;
- newEPTeachingSetting.EndWeeklyNum = newSpecialtyPlanView.EndWeeklyNum;
- newEPTeachingSettingInList.Add(newEPTeachingSetting);
- }
- else
- {
- //可更新的相关信息
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.Credit = newSpecialtyPlanView.Credit;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = newSpecialtyPlanView.TheoryCourse;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = newSpecialtyPlanView.Practicehours;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = newSpecialtyPlanView.Trialhours;
- if (newExecutablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = newSpecialtyPlanView.TheoryWeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = newSpecialtyPlanView.PracticeWeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = newSpecialtyPlanView.TrialWeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = newSpecialtyPlanView.WeeklyHours;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = newSpecialtyPlanView.WeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = newSpecialtyPlanView.StartWeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = newSpecialtyPlanView.EndWeeklyNum;
- }
- newEPTeachingSettingUpList.Add(newExecutablePlan.EM_ExecutablePlanTeachingSetting);
- }
- if (newExecutablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- //可更新的相关信息
- if (newSpecialtyPlanView.TeachingModeIDList != null && newSpecialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- executablePlanTMDelList.Add(newExecutablePlan.ExecutablePlanID);
- foreach (var newModeType in newSpecialtyPlanView.TeachingModeIDList.ToList())
- {
- var newEPTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newEPTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newEPTeachingModeType.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newEPTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newEPTeachingModeType);
- newEPTeachingModeTypeInList.Add(newEPTeachingModeType);
- }
- }
- else
- {
- executablePlanTMDelList.Add(newExecutablePlan.ExecutablePlanID);
- }
- }
- if (newSpecialtyPlanView.TeachingPlaceIDList != null && newSpecialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- executablePlanTPDelList.Add(newExecutablePlan.ExecutablePlanID);
- foreach (var newPlace in newSpecialtyPlanView.TeachingPlaceIDList.ToList())
- {
- var newEPTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newEPTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newEPTeachingPlace.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newEPTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newEPTeachingPlace);
- newEPTeachingPlaceInList.Add(newEPTeachingPlace);
- }
- }
- else
- {
- executablePlanTPDelList.Add(newExecutablePlan.ExecutablePlanID);
- }
- }
- executablePlanIDList.Add(newExecutablePlan.ExecutablePlanID);
- }
- }
- }
- }
- }
- else
- {
- //表示新增
- var newSpecialtyPlan = new EM_SpecialtyPlan();
- newSpecialtyPlan.SpecialtyPlanID = Guid.NewGuid();
- newSpecialtyPlan.PlanApplicationID = null;
- newSpecialtyPlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- newSpecialtyPlan.GrademajorID = specialtyPlanView.GrademajorID;
- newSpecialtyPlan.CoursematerialID = specialtyPlanView.CoursematerialID;
- newSpecialtyPlan.CourseStructureID = specialtyPlanView.CourseStructureID;
- newSpecialtyPlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
- newSpecialtyPlan.CourseTypeID = specialtyPlanView.CourseTypeID;
- newSpecialtyPlan.CourseQualityID = specialtyPlanView.CourseQualityID;
- newSpecialtyPlan.DepartmentID = specialtyPlanView.DepartmentID;
- newSpecialtyPlan.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- newSpecialtyPlan.IsCooperation = specialtyPlanView.IsCooperation;
- newSpecialtyPlan.IsRequired = specialtyPlanView.IsRequired;
- newSpecialtyPlan.IsElective = specialtyPlanView.IsElective;
- newSpecialtyPlan.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- newSpecialtyPlan.IsMainCourse = specialtyPlanView.IsMainCourse;
- newSpecialtyPlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
- newSpecialtyPlan.CourseFineID = specialtyPlanView.CourseFineID;
- newSpecialtyPlan.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- newSpecialtyPlan.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- newSpecialtyPlan.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- newSpecialtyPlan.ResultTypeID = specialtyPlanView.ResultTypeID;
- newSpecialtyPlan.HandleModeID = specialtyPlanView.HandleModeID;
- newSpecialtyPlan.Remark = specialtyPlanView.Remark;
- SetNewStatus(newSpecialtyPlan);
- newSpecialtyPlanInList.Add(newSpecialtyPlan);
- var newSPTeachingSetting = new EM_SpecialtyPlanTeachingSetting();
- newSPTeachingSetting.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- newSPTeachingSetting.Credit = specialtyPlanView.Credit;
- newSPTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- newSPTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- newSPTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- newSPTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- newSPTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- newSPTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- newSPTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- newSPTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- newSPTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- newSPTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- newSPTeachingSettingInList.Add(newSPTeachingSetting);
- if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- foreach (var teachingModeID in specialtyPlanView.TeachingModeIDList)
- {
- var newSPTeachingMode = new EM_SpecialtyPlanTeachingModeType();
- newSPTeachingMode.SpecialtyPlanTeachingModeTypeID = Guid.NewGuid();
- newSPTeachingMode.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- newSPTeachingMode.TeachingModeID = teachingModeID;
- SetNewStatus(newSPTeachingMode);
- newSPTeachingModeTypeInList.Add(newSPTeachingMode);
- }
- }
- if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- foreach (var teachingPlaceID in specialtyPlanView.TeachingPlaceIDList)
- {
- var newSPTeachingPlace = new EM_SpecialtyPlanTeachingPlace();
- newSPTeachingPlace.SpecialtyPlanTeachingPlaceID = Guid.NewGuid();
- newSPTeachingPlace.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- newSPTeachingPlace.TeachingPlace = teachingPlaceID;
- SetNewStatus(newSPTeachingPlace);
- newSPTeachingPlaceInList.Add(newSPTeachingPlace);
- }
- }
- //对应的执行计划信息更新(根据业务主键:学年学期ID、年级专业ID、课程信息ID)
- //注:由于相关业务主键冗余且同时存在主外键关联,目前不允许修改相关业务主键
- var executablePlan = SpecialtyPlanDAL.ExecutablePlanRepository.GetList(x => x.SchoolyearID == specialtyPlanView.SchoolyearID
- && x.GrademajorID == specialtyPlanView.GrademajorID
- && x.CoursematerialID == specialtyPlanView.CoursematerialID,
- (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).SingleOrDefault();
- if (executablePlan == null)
- {
- //表示不存在对应的执行计划信息(暂不新增)
- }
- else
- {
- //表示存在对应的执行计划信息(修改)
- executablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
- //暂不考虑
- //executablePlan.DefaultClassName = specialtyPlanView.CourseName + "-" + specialtyPlanView.GrademajorName;
- executablePlan.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- executablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- executablePlan.GrademajorID = specialtyPlanView.GrademajorID;
- executablePlan.CoursematerialID = specialtyPlanView.CoursematerialID;
- executablePlan.CourseStructureID = specialtyPlanView.CourseStructureID;
- executablePlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
- executablePlan.CourseTypeID = specialtyPlanView.CourseTypeID;
- executablePlan.CourseQualityID = specialtyPlanView.CourseQualityID;
- executablePlan.DepartmentID = specialtyPlanView.DepartmentID;
- executablePlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
- executablePlan.ResultTypeID = specialtyPlanView.ResultTypeID;
- executablePlan.HandleModeID = specialtyPlanView.HandleModeID;
- SetModifyStatus(executablePlan);
- newExecutablePlanUpList.Add(executablePlan);
- if (executablePlan.EM_ExecutablePlanProfile == null)
- {
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- newProfile.IsCooperation = specialtyPlanView.IsCooperation;
- newProfile.IsRequired = specialtyPlanView.IsRequired;
- newProfile.IsElective = specialtyPlanView.IsElective;
- newProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- newProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
- newProfile.CourseFineID = specialtyPlanView.CourseFineID;
- newProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- }
- else
- {
- executablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- executablePlan.EM_ExecutablePlanProfile.IsCooperation = specialtyPlanView.IsCooperation;
- executablePlan.EM_ExecutablePlanProfile.IsRequired = specialtyPlanView.IsRequired;
- executablePlan.EM_ExecutablePlanProfile.IsElective = specialtyPlanView.IsElective;
- executablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- executablePlan.EM_ExecutablePlanProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
- executablePlan.EM_ExecutablePlanProfile.CourseFineID = specialtyPlanView.CourseFineID;
- executablePlan.EM_ExecutablePlanProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- executablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- executablePlan.EM_ExecutablePlanProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- SetModifyStatus(executablePlan.EM_ExecutablePlanProfile);
- newProfileUpList.Add(executablePlan.EM_ExecutablePlanProfile);
- }
- if (executablePlan.EM_ExecutablePlanTeachingSetting == null)
- {
- var newEPTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newEPTeachingSetting.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingSetting.Credit = specialtyPlanView.Credit;
- newEPTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- newEPTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- newEPTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- newEPTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- newEPTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- newEPTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- newEPTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- newEPTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- newEPTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- newEPTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- newEPTeachingSettingInList.Add(newEPTeachingSetting);
- }
- else
- {
- //可更新的相关信息
- executablePlan.EM_ExecutablePlanTeachingSetting.Credit = specialtyPlanView.Credit;
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- executablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- executablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- }
- newEPTeachingSettingUpList.Add(executablePlan.EM_ExecutablePlanTeachingSetting);
- }
- if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- //可更新的相关信息
- if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newModeType in specialtyPlanView.TeachingModeIDList.ToList())
- {
- var newEPTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newEPTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newEPTeachingModeType.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newEPTeachingModeType);
- newEPTeachingModeTypeInList.Add(newEPTeachingModeType);
- }
- }
- else
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- }
- }
- if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newPlace in specialtyPlanView.TeachingPlaceIDList.ToList())
- {
- var newEPTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newEPTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newEPTeachingPlace.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newEPTeachingPlace);
- newEPTeachingPlaceInList.Add(newEPTeachingPlace);
- }
- }
- else
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- }
- executablePlanIDList.Add(executablePlan.ExecutablePlanID);
- }
- }
- //事务提交
- //UnitOfWork.Commit();
- using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew, new TransactionOptions { IsolationLevel = IsolationLevel.Serializable }))
- {
- //删除
- UnitOfWork.Delete<EM_SpecialtyPlanTeachingPlace>(x => specialtyPlanTPDelList.Contains(x.SpecialtyPlanID));
- UnitOfWork.Delete<EM_SpecialtyPlanTeachingModeType>(x => specialtyPlanTMDelList.Contains(x.SpecialtyPlanID));
- //批量插入
- UnitOfWork.BulkInsert(newSpecialtyPlanInList);
- UnitOfWork.BulkInsert(newSPTeachingSettingInList);
- UnitOfWork.BulkInsert(newSPTeachingModeTypeInList);
- UnitOfWork.BulkInsert(newSPTeachingPlaceInList);
- //批量统一提交更新
- if (newSpecialtyPlanUpList != null && newSpecialtyPlanUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newSpecialtyPlanUpList);
- }
- //批量统一提交更新
- if (newSPTeachingSettingUpList != null && newSPTeachingSettingUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newSPTeachingSettingUpList);
- }
- //删除
- UnitOfWork.Delete<EM_ExecutablePlanTeachingPlace>(x => executablePlanTPDelList.Contains(x.ExecutablePlanID));
- UnitOfWork.Delete<EM_ExecutablePlanTeachingModeType>(x => executablePlanTMDelList.Contains(x.ExecutablePlanID));
- //批量插入
- UnitOfWork.BulkInsert(newProfileInList);
- UnitOfWork.BulkInsert(newEPTeachingSettingInList);
- UnitOfWork.BulkInsert(newEPTeachingModeTypeInList);
- UnitOfWork.BulkInsert(newEPTeachingPlaceInList);
- //批量统一提交更新
- if (newExecutablePlanUpList != null && newExecutablePlanUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newExecutablePlanUpList);
- }
- //批量统一提交更新
- if (newProfileUpList != null && newProfileUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newProfileUpList);
- }
- //批量统一提交更新
- if (newEPTeachingSettingUpList != null && newEPTeachingSettingUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEPTeachingSettingUpList);
- }
- ts.Complete();
- }
- }
- else
- {
- throw new Exception("已存在相同的专业计划信息(学年学期、年级专业、课程信息唯一),请核查。");
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- }
- }
|