123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Linq.Expressions;
- using System.Transactions;
- using Bowin.Common.Utility;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.Utility;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.CacheManage;
- using EMIS.ViewModel.EducationManagement;
- using EMIS.ViewModel.CultureplanManage.PlanManagement;
- using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
- using EMIS.ViewModel.Students;
- using EMIS.ViewModel.Cultureplan;
- using EMIS.DataLogic.EducationManage;
- using EMIS.CommonLogic.StudentManage.StudentStatistics;
- namespace EMIS.CommonLogic.EducationManage
- {
- public class ExecutablePlanServices : BaseServices, IExecutablePlanServices
- {
- public ExecutablePlanDAL ExecutablePlanDAL { get; set; }
- public Lazy<IInSchoolSettingServices> InSchoolSettingServices { get; set; }
- /// <summary>
- /// 查询对应的执行计划信息ExecutablePlanView
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="grademajorID"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="isMainCourse"></param>
- /// <param name="teachingModeID"></param>
- /// <param name="handleModeID"></param>
- /// <param name="planTypeID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="approvalStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<ExecutablePlanView> GetExecutablePlanViewGrid(ConfiguretView configuretView, Guid? schoolyearID,
- Guid? campusID, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
- Guid? grademajorID, Guid? coursematerialID, int? isMainCourse, int? teachingModeID, int? handleModeID,
- int? planTypeID, int? inSchoolStatus, int? approvalStatus, int pageIndex, int pageSize)
- {
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.SchoolyearID == schoolyearID);
- }
- if (grademajorID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.GrademajorID == grademajorID);
- }
- if (coursematerialID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.CoursematerialID == coursematerialID);
- }
- if (handleModeID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.HandleModeID == handleModeID);
- }
- if (approvalStatus.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.RecordStatus == approvalStatus);
- }
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus.HasValue)
- {
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.Yes)
- {
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.No)
- {
- //不在校
- expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- var query = ExecutablePlanDAL.GetExecutablePlanViewQueryable(expExecutablePlan, expStudent);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (yearID.HasValue)
- {
- query = query.Where(x => x.GradeID == yearID);
- }
- if (standardID.HasValue)
- {
- query = query.Where(x => x.StandardID == standardID);
- }
- if (educationID.HasValue)
- {
- query = query.Where(x => x.EducationID == educationID);
- }
- if (learningformID.HasValue)
- {
- query = query.Where(x => x.LearningformID == learningformID);
- }
- if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(learnSystem);
- query = query.Where(x => x.LearnSystem == LearnSystems);
- }
- if (isMainCourse.HasValue)
- {
- //是否学位课程
- if (isMainCourse == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsMainCourse == true);
- }
- if (isMainCourse == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsMainCourse != true);
- }
- }
- if (teachingModeID.HasValue)
- {
- //授课方式
- query = query.Where(x => x.TeachingModeIDList.Contains(teachingModeID));
- }
- if (planTypeID.HasValue)
- {
- //计划类型
- query = query.Where(x => x.PlanTypeID == planTypeID);
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query)
- .OrderBy(x => x.GrademajorCode.Length).ThenBy(x => x.GrademajorCode)
- .ThenBy(x => x.Value).ThenBy(x => x.CourseTypeID)
- .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
- .ToGridResultSet<ExecutablePlanView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询对应的执行计划信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="grademajorID"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="isMainCourse"></param>
- /// <param name="teachingModeID"></param>
- /// <param name="handleModeID"></param>
- /// <param name="planTypeID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="approvalStatus"></param>
- /// <returns></returns>
- public IList<ExecutablePlanView> GetExecutablePlanViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID,
- Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
- Guid? grademajorID, Guid? coursematerialID, int? isMainCourse, int? teachingModeID, int? handleModeID,
- int? planTypeID, int? inSchoolStatus, int? approvalStatus)
- {
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.SchoolyearID == schoolyearID);
- }
- if (grademajorID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.GrademajorID == grademajorID);
- }
- if (coursematerialID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.CoursematerialID == coursematerialID);
- }
- if (handleModeID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.HandleModeID == handleModeID);
- }
- if (approvalStatus.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.RecordStatus == approvalStatus);
- }
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus.HasValue)
- {
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.Yes)
- {
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.No)
- {
- //不在校
- expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- var query = ExecutablePlanDAL.GetExecutablePlanViewQueryable(expExecutablePlan, expStudent);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (yearID.HasValue)
- {
- query = query.Where(x => x.GradeID == yearID);
- }
- if (standardID.HasValue)
- {
- query = query.Where(x => x.StandardID == standardID);
- }
- if (educationID.HasValue)
- {
- query = query.Where(x => x.EducationID == educationID);
- }
- if (learningformID.HasValue)
- {
- query = query.Where(x => x.LearningformID == learningformID);
- }
- if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(learnSystem);
- query = query.Where(x => x.LearnSystem == LearnSystems);
- }
- if (isMainCourse.HasValue)
- {
- //是否学位课程
- if (isMainCourse == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsMainCourse == true);
- }
- if (isMainCourse == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsMainCourse != true);
- }
- }
- if (teachingModeID.HasValue)
- {
- //授课方式
- query = query.Where(x => x.TeachingModeIDList.Contains(teachingModeID));
- }
- if (planTypeID.HasValue)
- {
- //计划类型
- query = query.Where(x => x.PlanTypeID == planTypeID);
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query)
- .OrderBy(x => x.GrademajorCode.Length).ThenBy(x => x.GrademajorCode)
- .ThenBy(x => x.Value).ThenBy(x => x.CourseTypeID)
- .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode).ToList();
- }
- /// <summary>
- /// 查询对应的执行计划信息ExecutablePlanView(根据执行计划ID)
- /// </summary>
- /// <param name="executablePlanID"></param>
- /// <returns></returns>
- public ExecutablePlanView GetExecutablePlanView(Guid? executablePlanID)
- {
- try
- {
- var executablePlanView = ExecutablePlanDAL.GetExecutablePlanViewQueryable(x => x.ExecutablePlanID == executablePlanID).SingleOrDefault();
- return executablePlanView;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 编辑(新增、修改,业务主键:学年学期ID、年级专业ID、课程信息ID)
- /// 注:关联对应的专业计划、刷新相关的教学任务信息
- /// 注:区分普教版本(年级专业)、成教版本(入学学年学期、专业信息)
- /// 注:默认为普教版本(年级专业)
- /// 注:此版本学生人数小于等于0时,也可提交,同时也需进一步优化逻辑(对教学任务班学生名单进行判断)
- /// </summary>
- /// <param name="executablePlanView"></param>
- public virtual void ExecutablePlanEdit(ExecutablePlanView executablePlanView)
- {
- try
- {
- //查询对应的课程信息
- var coursematerial = ExecutablePlanDAL.CoursematerialRepository
- .GetList(x => x.CoursematerialID == executablePlanView.CoursematerialID).SingleOrDefault();
- if (coursematerial == null)
- {
- throw new Exception("课程信息不存在,请检查。");
- }
- //查询对应的年级专业信息
- var grademajor = ExecutablePlanDAL.GrademajorRepository
- .GetList(x => x.GrademajorID == executablePlanView.GrademajorID).SingleOrDefault();
- if (grademajor == null)
- {
- throw new Exception("年级专业信息不存在,请检查。");
- }
- //查询年级专业对应的入学学年学期信息
- var startSchoolyear = ExecutablePlanDAL.SchoolyearRepository.GetList(x => x.Years == grademajor.GradeID && x.SchoolcodeID == grademajor.SemesterID).SingleOrDefault();
- if (startSchoolyear == null)
- {
- throw new Exception("年级专业对应的入学学年学期信息不存在,请检查。");
- }
- //查询年级专业对应的毕业学年学期信息
- var graduatingSemester = ExecutablePlanDAL.SchoolyearRepository.GetList(x => x.SchoolyearID == grademajor.GraduateSchoolyearID).SingleOrDefault();
- if (graduatingSemester == null)
- {
- throw new Exception("年级专业对应的毕业学年学期信息不存在,请检查。");
- }
- //查询对应的学年学期信息
- var schoolyear = ExecutablePlanDAL.SchoolyearRepository.GetList(x => x.SchoolyearID == executablePlanView.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 executablePlanVerify = ExecutablePlanDAL.ExecutablePlanRepository
- .GetList(x => x.ExecutablePlanID != executablePlanView.ExecutablePlanID
- && x.SchoolyearID == executablePlanView.SchoolyearID
- && x.GrademajorID == executablePlanView.GrademajorID
- && x.CoursematerialID == executablePlanView.CoursematerialID).SingleOrDefault();
- if (executablePlanVerify == null)
- {
- if (executablePlanView.TeachingModeIDList == null || executablePlanView.TeachingModeIDList.Count() <= 0)
- {
- throw new Exception("请选择至少一种授课方式,请检查。");
- }
-
- //查询对应的专业计划信息(业务主键:学年学期ID、年级专业ID、课程信息ID)
- var specialtyPlan = ExecutablePlanDAL.SpecialtyPlanRepository
- .GetList(x => x.SchoolyearID == executablePlanView.SchoolyearID
- && x.GrademajorID == executablePlanView.GrademajorID
- && x.CoursematerialID == executablePlanView.CoursematerialID).SingleOrDefault();
- List<EM_ExecutablePlan> newExecutablePlanInList = new List<EM_ExecutablePlan>();
- 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<EM_EducationMission> newEducationMissionInList = new List<EM_EducationMission>();
- List<EM_EducationMission> newEducationMissionUpList = new List<EM_EducationMission>();
- List<EM_EducationMissionClass> newEducationMissionClassInList = new List<EM_EducationMissionClass>();
- List<EM_EducationMissionClass> newEducationMissionClassUpList = new List<EM_EducationMissionClass>();
- List<EM_EducationMissionClassTeachingSetting> newEduTeachingSettingInList = new List<EM_EducationMissionClassTeachingSetting>();
- List<EM_EducationMissionClassTeachingSetting> newEduTeachingSettingUpList = new List<EM_EducationMissionClassTeachingSetting>();
- List<EM_EducationSchedulingClass> newEducationSchedulingClassInList = new List<EM_EducationSchedulingClass>();
- List<EM_EducationMissionClassSettings> newEduSettingsInList = new List<EM_EducationMissionClassSettings>();
- List<EM_CourseProcess> newCourseProcessInList = new List<EM_CourseProcess>();
- //数据有误验证
- if (executablePlanView.ExecutablePlanID != Guid.Empty)
- {
- var executablePlan = ExecutablePlanDAL.ExecutablePlanRepository
- .GetList(x => x.ExecutablePlanID == executablePlanView.ExecutablePlanID,
- (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).SingleOrDefault();
- if (executablePlan == null)
- {
- throw new Exception("数据有误,请核查。");
- }
- else
- {
- //表示修改
- executablePlan.SourceTypeID = executablePlanView.SourceTypeID;
- executablePlan.DefaultClassName = coursematerial.CourseName + "-" + grademajor.Name;
- if (specialtyPlan == null)
- {
- executablePlan.SpecialtyPlanID = null;
- }
- else
- {
- executablePlan.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- }
- executablePlan.SchoolyearID = executablePlanView.SchoolyearID;
- executablePlan.GrademajorID = executablePlanView.GrademajorID;
- executablePlan.CoursematerialID = executablePlanView.CoursematerialID;
- executablePlan.CourseStructureID = executablePlanView.CourseStructureID;
- executablePlan.CourseCategoryID = executablePlanView.CourseCategoryID;
- executablePlan.CourseTypeID = executablePlanView.CourseTypeID;
- executablePlan.CourseQualityID = executablePlanView.CourseQualityID;
- executablePlan.DepartmentID = executablePlanView.DepartmentID;
- if (executablePlanView.PlanTypeID == (int)EM_PlanType.Outside)
- {
- executablePlan.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- }
- executablePlan.ResultTypeID = executablePlanView.ResultTypeID;
- executablePlan.HandleModeID = executablePlanView.HandleModeID;
- SetModifyStatus(executablePlan);
- newExecutablePlanUpList.Add(executablePlan);
- if (executablePlan.EM_ExecutablePlanProfile == null)
- {
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = executablePlanView.IsSpecialtycore;
- newProfile.IsCooperation = executablePlanView.IsCooperation;
- newProfile.IsRequired = executablePlanView.IsRequired;
- newProfile.IsElective = executablePlanView.IsElective;
- newProfile.IsNetworkCourse = executablePlanView.IsNetworkCourse;
- newProfile.IsMainCourse = executablePlanView.IsMainCourse;
- newProfile.CourseFineID = executablePlanView.CourseFineID;
- newProfile.PracticeTypeID = executablePlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = executablePlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- }
- else
- {
- if (executablePlanView.PlanTypeID == (int)EM_PlanType.Outside)
- {
- executablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = executablePlanView.IsSpecialtycore;
- executablePlan.EM_ExecutablePlanProfile.IsCooperation = executablePlanView.IsCooperation;
- executablePlan.EM_ExecutablePlanProfile.IsRequired = executablePlanView.IsRequired;
- executablePlan.EM_ExecutablePlanProfile.IsElective = executablePlanView.IsElective;
- executablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = executablePlanView.IsNetworkCourse;
- executablePlan.EM_ExecutablePlanProfile.IsMainCourse = executablePlanView.IsMainCourse;
- executablePlan.EM_ExecutablePlanProfile.CourseFineID = executablePlanView.CourseFineID;
- executablePlan.EM_ExecutablePlanProfile.PracticeTypeID = executablePlanView.PracticeTypeID;
- executablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- executablePlan.EM_ExecutablePlanProfile.ExaminationModeID = executablePlanView.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 = executablePlanView.Credit;
- newEPTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- newEPTeachingSetting.Practicehours = executablePlanView.Practicehours;
- newEPTeachingSetting.Trialhours = executablePlanView.Trialhours;
- newEPTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- newEPTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- newEPTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- newEPTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- newEPTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- newEPTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- newEPTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEPTeachingSettingInList.Add(newEPTeachingSetting);
- }
- else
- {
- if (executablePlanView.PlanTypeID == (int)EM_PlanType.Outside)
- {
- executablePlan.EM_ExecutablePlanTeachingSetting.Credit = executablePlanView.Credit;
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- executablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = executablePlanView.Practicehours;
- executablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = executablePlanView.Trialhours;
- }
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEPTeachingSettingUpList.Add(executablePlan.EM_ExecutablePlanTeachingSetting);
- }
- if (executablePlanView.TeachingModeIDList != null && executablePlanView.TeachingModeIDList.Count() > 0)
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newModeType in executablePlanView.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 (executablePlanView.TeachingPlaceIDList != null && executablePlanView.TeachingPlaceIDList.Count() > 0)
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newPlace in executablePlanView.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);
- }
- //对应的教学任务信息更新(根据业务主键:学年学期ID、课程信息ID、班级信息ID、排课任务班ID或教学任务班ID)
- //注:由于相关业务主键冗余,目前不允许修改相关业务主键
- //教学任务班生成规则如下:
- //1、对应的授课方式为必选项且可多选;
- //2、课程信息对应的上课类型为空时,默认只生成一种类型的教学任务班(授课方式为最小Value授课方式);
- //3、以上课类型为标准,匹配对应的授课方式来生成教学任务班;
- //4、根据授课方式与上课类型查询是否分班情况,存在分班情况,则生成对应的教学任务班;
- //5、对应的授课方式存在分班情况时,默认生成成绩合并录入形式的教学任务班(同一条教学任务);
- //6、年级专业对应的计划范围不于等于0时,不生成对应的教学任务班(无法生成);
- //7、年级专业对应的学生人数小于等于0时,不生成对应的教学任务班(成教版本有此逻辑);
- //8、如对应的年级专业有多个班级,都生成对应的教学任务班(只取在校状态为在校的学生信息);
- if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.Submited)
- {
- //年级专业
- Expression<Func<CF_Grademajor, bool>> expGrademajor = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expGrademajor = expGrademajor.And(x => x.GrademajorID == executablePlanView.GrademajorID);
- //查询对应的班级范围信息classmajorList
- var classmajorList = ExecutablePlanDAL.GetClassmajorRangeQueryable(expGrademajor).ToList();
- //执行计划对应的计划范围判断
- if (classmajorList != null && classmajorList.Count() > 0)
- {
- //查询对应的学生范围信息studentList
- var studentList = ExecutablePlanDAL.GetStudentRangeQueryable(expGrademajor).ToList();
- ////执行计划对应的学生范围判断
- //if (studentList != null && studentList.Count() > 0)
- //{
-
- //}
- //else
- //{
- // //表示执行计划对应的学生范围不存在(小于等于0)
- // //throw new Exception("执行计划对应的学生范围不存在(小于等于0),请核查。");
- //}
- //查询对应在校状态IDList
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- //查询对应的课程信息中授课方式分班信息List
- var separateModeTypeList = ExecutablePlanDAL.GetSeparateModeTypeQueryble(x => x.CoursematerialID == executablePlanView.CoursematerialID).ToList();
- //查询授课方式teachingModeList
- var teachingModeList = DictionaryHelper.GetDictionaryValue(ViewModel.DictionaryItem.CF_TeachingMode).ToList();
- //查询执行计划中授课方式及对应的上课类型中的授课方式(匹配上课类型)
- var minTeachingModeID = executablePlanView.TeachingModeIDList
- .Where(x => !separateModeTypeList.Contains(x)).OrderBy(x => x).FirstOrDefault();
- List<int?> teachingModeIDList = new List<int?>();
- if (minTeachingModeID != null)
- {
- teachingModeIDList.Add(minTeachingModeID);
- teachingModeIDList = teachingModeIDList.Concat(executablePlanView.TeachingModeIDList
- .Where(x => separateModeTypeList.Contains(x))).GroupBy(x => x).Select(x => x.Key).ToList();
- }
- else
- {
- teachingModeIDList = executablePlanView.TeachingModeIDList
- .Where(x => separateModeTypeList.Contains(x)).GroupBy(x => x).Select(x => x.Key).ToList();
- }
- //查询对应的授课方式信息List(匹配上课类型)
- var epTeachingModeList = teachingModeList.Where(x => teachingModeIDList.Contains(x.Value)).ToList();
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expExecutablePlan = expExecutablePlan.And(x => x.ExecutablePlanID == executablePlanView.ExecutablePlanID);
- //查询对应的教学任务班信息(业务主键:学年学期ID、课程信息ID、班级信息ID、排课任务班ID或教学任务班ID)
- var educationMissionClassList = ExecutablePlanDAL.GetEducationMissionClassQueryable(expExecutablePlan).ToList();
- foreach (var classmajor in classmajorList)
- {
- //查询班级信息对应的教学任务班信息List
- var educlList = educationMissionClassList.Where(x => x.CF_Classmajor
- .Any(w => w.ClassmajorID == classmajor.ClassmajorID)).ToList();
- if (educlList != null && educlList.Count() > 0)
- {
- //表示存在对应的教学任务班
- //根据教学任务ID对educlList进行分组
- var edugrList = educlList.GroupBy(x => x.EducationMissionID).ToList();
- //根据授课方式对educlList进行分组
- var tmgrList = educlList.GroupBy(x => x.TeachingModeID).ToList();
- if (edugrList.Count() > 1 && tmgrList.Count() > 1)
- {
- //表示对应的教学任务班存在分班且成绩分开录入、授课方式多种情况
- //目前此种数据有误,在生成期末设定时有问题(这里暂不处理)
- throw new Exception("对应的教学任务班中存在分班且成绩分开录入、授课方式多种的信息(请删除后,再保存),请核查。");
- }
- else if (edugrList.Count() > 1 && epTeachingModeList.Count() > 1)
- {
- //表示对应的教学任务班存在分班且成绩分开录入、授课方式只有一种情况,不可再生成多种授课方式的教学任务班信息
- //目前此种数据有误,在生成期末设定时有问题
- throw new Exception("对应的教学任务班中存在分班且成绩分开录入的信息,不可再生成多种授课方式的教学任务班信息(请删除后,再保存),请核查。");
- }
- else if (tmgrList.Count() == 1 && epTeachingModeList.Count() == 1)
- {
- //表示对应的教学任务班只存在一种授课方式信息(含分班且成绩合并或分开录入)
- //同时生成的教学任务班信息授课方式只有一种的情况(直接修改)
- foreach (var educl in educlList)
- {
- if (!newEducationMissionUpList.Any(x => x.EducationMissionID == educl.EducationMissionID))
- {
- educl.EM_EducationMission.ClassName = coursematerial.CourseName + "-" + classmajor.Name;
- educl.EM_EducationMission.SchoolyearID = executablePlanView.SchoolyearID;
- educl.EM_EducationMission.CollegeID = executablePlanView.CollegeID;
- educl.EM_EducationMission.DepartmentID = executablePlanView.DepartmentID;
- SetModifyStatus(educl.EM_EducationMission);
- newEducationMissionUpList.Add(educl.EM_EducationMission);
- }
- if (!newEducationMissionClassUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- educl.CoursematerialID = executablePlanView.CoursematerialID;
- educl.CourseStructureID = executablePlanView.CourseStructureID;
- educl.CourseCategoryID = executablePlanView.CourseCategoryID;
- educl.CourseTypeID = executablePlanView.CourseTypeID;
- educl.CourseQualityID = executablePlanView.CourseQualityID;
- educl.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- educl.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- educl.ExaminationModeID = executablePlanView.ExaminationModeID;
- educl.ResultTypeID = executablePlanView.ResultTypeID;
- educl.HandleModeID = executablePlanView.HandleModeID;
- educl.TeachingModeID = epTeachingModeList[0].Value;
- SetModifyStatus(educl);
- newEducationMissionClassUpList.Add(educl);
- }
- if (!newEduTeachingSettingUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.EM_EducationMissionClassTeachingSetting.Credit = executablePlanView.Credit;
- educl.EM_EducationMissionClassTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- educl.EM_EducationMissionClassTeachingSetting.Practicehours = executablePlanView.Practicehours;
- educl.EM_EducationMissionClassTeachingSetting.Trialhours = executablePlanView.Trialhours;
- //if (educl.RecordStatus != (int)EM_EducationMissionClassStatus.Submitted || educl.RecordStatus != (int)EM_EducationMissionClassStatus.Scheduled)
- //{
- // //暂不考虑
- // educl.EM_EducationMissionClassTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- //}
- newEduTeachingSettingUpList.Add(educl.EM_EducationMissionClassTeachingSetting);
- }
- }
- }
- else
- {
- //表示无论分班与否,成绩都是合并录入的情况(同一个教学任务ID)
- //表示可根据执行计划中匹配上课类型后的授课方式进行增加、修改对应的教学任务班信息
- foreach (var educl in educlList)
- {
- //修改
- if (!newEducationMissionUpList.Any(x => x.EducationMissionID == educl.EducationMissionID))
- {
- educl.EM_EducationMission.ClassName = coursematerial.CourseName + "-" + classmajor.Name;
- educl.EM_EducationMission.SchoolyearID = executablePlanView.SchoolyearID;
- educl.EM_EducationMission.CollegeID = executablePlanView.CollegeID;
- educl.EM_EducationMission.DepartmentID = executablePlanView.DepartmentID;
- SetModifyStatus(educl.EM_EducationMission);
- newEducationMissionUpList.Add(educl.EM_EducationMission);
- }
- if (!newEducationMissionClassUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- educl.CoursematerialID = executablePlanView.CoursematerialID;
- educl.CourseStructureID = executablePlanView.CourseStructureID;
- educl.CourseCategoryID = executablePlanView.CourseCategoryID;
- educl.CourseTypeID = executablePlanView.CourseTypeID;
- educl.CourseQualityID = executablePlanView.CourseQualityID;
- educl.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- educl.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- educl.ExaminationModeID = executablePlanView.ExaminationModeID;
- educl.ResultTypeID = executablePlanView.ResultTypeID;
- educl.HandleModeID = executablePlanView.HandleModeID;
- SetModifyStatus(educl);
- newEducationMissionClassUpList.Add(educl);
- }
- if (!newEduTeachingSettingUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.EM_EducationMissionClassTeachingSetting.Credit = executablePlanView.Credit;
- educl.EM_EducationMissionClassTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- educl.EM_EducationMissionClassTeachingSetting.Practicehours = executablePlanView.Practicehours;
- educl.EM_EducationMissionClassTeachingSetting.Trialhours = executablePlanView.Trialhours;
- //if (educl.RecordStatus != (int)EM_EducationMissionClassStatus.Submitted || educl.RecordStatus != (int)EM_EducationMissionClassStatus.Scheduled)
- //{
- // //暂不考虑
- // educl.EM_EducationMissionClassTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- //}
- newEduTeachingSettingUpList.Add(educl.EM_EducationMissionClassTeachingSetting);
- }
- }
- //将执行计划中匹配上课类型后的授课方式与对应的教学任务班的授课方式进行对比
- var educltmList = tmgrList.Select(x => x.Key).ToList();
- var newTeachingModeList = epTeachingModeList.Where(x => !educltmList.Contains(x.Value)).ToList();
- foreach (var newTeachingMode in newTeachingModeList)
- {
- //新增
- var newEducationMissionClass = new EM_EducationMissionClass();
- newEducationMissionClass.EducationMissionClassID = Guid.NewGuid();
- newEducationMissionClass.EducationMissionID = edugrList[0].Key;
- newEducationMissionClass.MainScheduleClassID = classmajor.ClassmajorID;
- newEducationMissionClass.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- newEducationMissionClass.OrderNo = classmajor.ClassNum ?? 1;
- newEducationMissionClass.Name = coursematerial.CourseName + "-" + classmajor.Name + "-(" + newTeachingMode.Name + ")";
- newEducationMissionClass.CoursematerialID = executablePlanView.CoursematerialID;
- newEducationMissionClass.CourseStructureID = executablePlanView.CourseStructureID;
- newEducationMissionClass.CourseCategoryID = executablePlanView.CourseCategoryID;
- newEducationMissionClass.CourseTypeID = executablePlanView.CourseTypeID;
- newEducationMissionClass.CourseQualityID = executablePlanView.CourseQualityID;
- newEducationMissionClass.ClassroomTypeID = null;
- newEducationMissionClass.ClassroomID = null;
- newEducationMissionClass.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- newEducationMissionClass.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- newEducationMissionClass.ExaminationModeID = executablePlanView.ExaminationModeID;
- newEducationMissionClass.ResultTypeID = executablePlanView.ResultTypeID;
- newEducationMissionClass.HandleModeID = executablePlanView.HandleModeID;
- newEducationMissionClass.TeachingModeID = newTeachingMode.Value;
- newEducationMissionClass.Remark = coursematerial.CourseName + "-" + classmajor.Name + "-(" + newTeachingMode.Name + ")";
- SetNewStatus(newEducationMissionClass, (int)EM_EducationMissionClassStatus.NotSubmitted);
- newEducationMissionClassInList.Add(newEducationMissionClass);
- var newEduTeachingSetting = new EM_EducationMissionClassTeachingSetting();
- newEduTeachingSetting.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduTeachingSetting.Credit = executablePlanView.Credit;
- newEduTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- newEduTeachingSetting.Practicehours = executablePlanView.Practicehours;
- newEduTeachingSetting.Trialhours = executablePlanView.Trialhours;
- newEduTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- newEduTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- newEduTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- newEduTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- newEduTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- newEduTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- newEduTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEduTeachingSettingInList.Add(newEduTeachingSetting);
- newEducationMissionClass.CF_Classmajor = new HashSet<CF_Classmajor>();
- newEducationMissionClass.CF_Classmajor.Add(classmajor);
- var newEducationSchedulingClass = new EM_EducationSchedulingClass();
- newEducationSchedulingClass.EducationSchedulingClassID = Guid.NewGuid();
- newEducationSchedulingClass.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationSchedulingClass.TaskGroupName = "1组";
- newEducationSchedulingClass.Remark = classmajor.Name;
- SetNewStatus(newEducationSchedulingClass);
- newEducationSchedulingClassInList.Add(newEducationSchedulingClass);
- newEducationSchedulingClass.CF_Student = new HashSet<CF_Student>();
- var newStudent = studentList.Where(x => x.ClassmajorID == classmajor.ClassmajorID
- && inschoolStatusList.Contains(x.InSchoolStatusID)).ToList();
- newStudent.ForEach(x => newEducationSchedulingClass.CF_Student.Add(x));
- for (int i = 0; i < executablePlanView.EndWeeklyNum; i++)
- {
- var newEduSettings = new EM_EducationMissionClassSettings();
- newEduSettings.EducationMissionClassSettingsID = Guid.NewGuid();
- newEduSettings.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduSettings.WeeklyNum = i + 1;
- SetNewStatus(newEduSettings);
- newEduSettingsInList.Add(newEduSettings);
- var newCourseProcess = new EM_CourseProcess();
- newCourseProcess.CourseProcessID = Guid.NewGuid();
- newCourseProcess.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newCourseProcess.Week = i + 1;
- newCourseProcess.Times = executablePlanView.WeeklyHours;
- newCourseProcessInList.Add(newCourseProcess);
- }
- }
- }
- }
- else
- {
- //表示不存在对应的教学任务班(新增)
- var newEducationMission = new EM_EducationMission();
- newEducationMission.EducationMissionID = Guid.NewGuid();
- newEducationMission.ClassName = coursematerial.CourseName + "-" + classmajor.Name;
- newEducationMission.SchoolyearID = executablePlanView.SchoolyearID;
- newEducationMission.CollegeID = executablePlanView.CollegeID;
- newEducationMission.DepartmentID = executablePlanView.DepartmentID;
- SetNewStatus(newEducationMission);
- newEducationMissionInList.Add(newEducationMission);
- foreach (var epTeachingMode in epTeachingModeList)
- {
- var newEducationMissionClass = new EM_EducationMissionClass();
- newEducationMissionClass.EducationMissionClassID = Guid.NewGuid();
- newEducationMissionClass.EducationMissionID = newEducationMission.EducationMissionID;
- newEducationMissionClass.MainScheduleClassID = classmajor.ClassmajorID;
- newEducationMissionClass.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- newEducationMissionClass.OrderNo = classmajor.ClassNum ?? 1;
- newEducationMissionClass.Name = coursematerial.CourseName + "-" + classmajor.Name + "-(" + epTeachingMode.Name + ")";
- newEducationMissionClass.CoursematerialID = executablePlanView.CoursematerialID;
- newEducationMissionClass.CourseStructureID = executablePlanView.CourseStructureID;
- newEducationMissionClass.CourseCategoryID = executablePlanView.CourseCategoryID;
- newEducationMissionClass.CourseTypeID = executablePlanView.CourseTypeID;
- newEducationMissionClass.CourseQualityID = executablePlanView.CourseQualityID;
- newEducationMissionClass.ClassroomTypeID = null;
- newEducationMissionClass.ClassroomID = null;
- newEducationMissionClass.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- newEducationMissionClass.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- newEducationMissionClass.ExaminationModeID = executablePlanView.ExaminationModeID;
- newEducationMissionClass.ResultTypeID = executablePlanView.ResultTypeID;
- newEducationMissionClass.HandleModeID = executablePlanView.HandleModeID;
- newEducationMissionClass.TeachingModeID = epTeachingMode.Value;
- newEducationMissionClass.Remark = coursematerial.CourseName + "-" + classmajor.Name + "-(" + epTeachingMode.Name + ")";
- SetNewStatus(newEducationMissionClass, (int)EM_EducationMissionClassStatus.NotSubmitted);
- newEducationMissionClassInList.Add(newEducationMissionClass);
- var newEduTeachingSetting = new EM_EducationMissionClassTeachingSetting();
- newEduTeachingSetting.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduTeachingSetting.Credit = executablePlanView.Credit;
- newEduTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- newEduTeachingSetting.Practicehours = executablePlanView.Practicehours;
- newEduTeachingSetting.Trialhours = executablePlanView.Trialhours;
- newEduTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- newEduTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- newEduTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- newEduTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- newEduTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- newEduTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- newEduTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEduTeachingSettingInList.Add(newEduTeachingSetting);
- newEducationMissionClass.CF_Classmajor = new HashSet<CF_Classmajor>();
- newEducationMissionClass.CF_Classmajor.Add(classmajor);
- var newEducationSchedulingClass = new EM_EducationSchedulingClass();
- newEducationSchedulingClass.EducationSchedulingClassID = Guid.NewGuid();
- newEducationSchedulingClass.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationSchedulingClass.TaskGroupName = "1组";
- newEducationSchedulingClass.Remark = classmajor.Name;
- SetNewStatus(newEducationSchedulingClass);
- newEducationSchedulingClassInList.Add(newEducationSchedulingClass);
- newEducationSchedulingClass.CF_Student = new HashSet<CF_Student>();
- var newStudent = studentList.Where(x => x.ClassmajorID == classmajor.ClassmajorID
- && inschoolStatusList.Contains(x.InSchoolStatusID)).ToList();
- newStudent.ForEach(x => newEducationSchedulingClass.CF_Student.Add(x));
- for (int i = 0; i < executablePlanView.EndWeeklyNum; i++)
- {
- var newEduSettings = new EM_EducationMissionClassSettings();
- newEduSettings.EducationMissionClassSettingsID = Guid.NewGuid();
- newEduSettings.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduSettings.WeeklyNum = i + 1;
- SetNewStatus(newEduSettings);
- newEduSettingsInList.Add(newEduSettings);
- var newCourseProcess = new EM_CourseProcess();
- newCourseProcess.CourseProcessID = Guid.NewGuid();
- newCourseProcess.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newCourseProcess.Week = i + 1;
- newCourseProcess.Times = executablePlanView.WeeklyHours;
- newCourseProcessInList.Add(newCourseProcess);
- }
- }
- }
- }
- }
- else
- {
- //表示执行计划对应的计划范围不存在(小于等于0)
- //throw new Exception("执行计划对应的计划范围不存在(小于等于0),请核查。");
- }
- }
- else
- {
- //表示未提交
- //暂不考虑对相关教学任务信息的处理
- }
- }
- }
- else
- {
- //表示新增
- var newExecutablePlan = new EM_ExecutablePlan();
- newExecutablePlan.ExecutablePlanID = Guid.NewGuid();
- newExecutablePlan.SourceTypeID = executablePlanView.SourceTypeID;
- newExecutablePlan.DefaultClassName = coursematerial.CourseName + "-" + grademajor.Name;
- if (specialtyPlan == null)
- {
- newExecutablePlan.SpecialtyPlanID = null;
- }
- else
- {
- newExecutablePlan.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- }
- newExecutablePlan.SchoolyearID = executablePlanView.SchoolyearID;
- newExecutablePlan.GrademajorID = executablePlanView.GrademajorID;
- newExecutablePlan.CoursematerialID = executablePlanView.CoursematerialID;
- newExecutablePlan.CourseStructureID = executablePlanView.CourseStructureID;
- newExecutablePlan.CourseCategoryID = executablePlanView.CourseCategoryID;
- newExecutablePlan.CourseTypeID = executablePlanView.CourseTypeID;
- newExecutablePlan.CourseQualityID = executablePlanView.CourseQualityID;
- newExecutablePlan.DepartmentID = executablePlanView.DepartmentID;
- newExecutablePlan.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- newExecutablePlan.ResultTypeID = executablePlanView.ResultTypeID;
- newExecutablePlan.HandleModeID = executablePlanView.HandleModeID;
- newExecutablePlan.Remark = executablePlanView.Remark;
- SetNewStatus(newExecutablePlan, (int)EM_ExecuteStatus.NotSubmited);
- newExecutablePlanInList.Add(newExecutablePlan);
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = executablePlanView.IsSpecialtycore;
- newProfile.IsCooperation = executablePlanView.IsCooperation;
- newProfile.IsRequired = executablePlanView.IsRequired;
- newProfile.IsElective = executablePlanView.IsElective;
- newProfile.IsNetworkCourse = executablePlanView.IsNetworkCourse;
- newProfile.IsMainCourse = executablePlanView.IsMainCourse;
- newProfile.CourseFineID = executablePlanView.CourseFineID;
- newProfile.PracticeTypeID = executablePlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = executablePlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- var newEPTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newEPTeachingSetting.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newEPTeachingSetting.Credit = executablePlanView.Credit;
- newEPTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- newEPTeachingSetting.Practicehours = executablePlanView.Practicehours;
- newEPTeachingSetting.Trialhours = executablePlanView.Trialhours;
- newEPTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- newEPTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- newEPTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- newEPTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- newEPTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- newEPTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- newEPTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEPTeachingSettingInList.Add(newEPTeachingSetting);
- if (executablePlanView.TeachingModeIDList != null && executablePlanView.TeachingModeIDList.Count() > 0)
- {
- foreach (var newModeType in executablePlanView.TeachingModeIDList.ToList())
- {
- var newEPTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newEPTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newEPTeachingModeType.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newEPTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newEPTeachingModeType);
- newEPTeachingModeTypeInList.Add(newEPTeachingModeType);
- }
- }
- if (executablePlanView.TeachingPlaceIDList != null && executablePlanView.TeachingPlaceIDList.Count() > 0)
- {
- foreach (var newPlace in executablePlanView.TeachingPlaceIDList.ToList())
- {
- var newEPTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newEPTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newEPTeachingPlace.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newEPTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newEPTeachingPlace);
- newEPTeachingPlaceInList.Add(newEPTeachingPlace);
- }
- }
- //对应的教学任务信息更新(根据业务主键:学年学期ID、课程信息ID、班级信息ID、排课任务班ID或教学任务班ID)
- //注:由于相关业务主键冗余,目前不允许修改相关业务主键
- //暂不考虑对相关教学任务信息的处理
- }
- //事务提交
- //UnitOfWork.Commit();
- using (TransactionScope ts = new TransactionScope())
- {
- //删除
- UnitOfWork.Delete<EM_ExecutablePlanTeachingPlace>(x => executablePlanTPDelList.Contains(x.ExecutablePlanID));
- UnitOfWork.Delete<EM_ExecutablePlanTeachingModeType>(x => executablePlanTMDelList.Contains(x.ExecutablePlanID));
- //批量插入
- UnitOfWork.BulkInsert(newExecutablePlanInList);
- 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);
- }
- //批量插入
- UnitOfWork.BulkInsert(newEducationMissionInList);
- UnitOfWork.BulkInsert(newEducationMissionClassInList);
- UnitOfWork.BulkInsert(newEduTeachingSettingInList);
- UnitOfWork.BulkInsert(newEducationMissionClassInList, (x => x.CF_Classmajor));
- UnitOfWork.BulkInsert(newEducationSchedulingClassInList);
- UnitOfWork.BulkInsert(newEducationSchedulingClassInList, (x => x.CF_Student));
- UnitOfWork.BulkInsert(newEduSettingsInList);
- UnitOfWork.BulkInsert(newCourseProcessInList);
- //批量统一提交更新
- if (newEducationMissionUpList != null && newEducationMissionUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEducationMissionUpList);
- }
- //批量统一提交更新
- if (newEducationMissionClassUpList != null && newEducationMissionClassUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEducationMissionClassUpList);
- }
- //批量统一提交更新
- if (newEduTeachingSettingUpList != null && newEduTeachingSettingUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEduTeachingSettingUpList);
- }
- ts.Complete();
- }
- }
- else
- {
- throw new Exception("已存在相同的执行计划信息(学年学期、年级专业、课程信息唯一),请核查。");
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 根据专业计划信息批量新增
- /// 注:区分普教版本(年级专业)、成教版本(入学学年学期、专业信息)
- /// 注:默认为普教版本(年级专业)
- /// 注:此版本学生人数小于等于0时,也可生成对应的执行计划
- /// </summary>
- /// <param name="specialtyPlanViewList"></param>
- /// <param name="executablePlanView"></param>
- /// <returns></returns>
- public virtual string ExecutablePlanBatchAdd(List<SpecialtyPlanView> specialtyPlanViewList, ExecutablePlanView executablePlanView)
- {
- try
- {
- //查询专业计划对应的年级专业grademajorIDList
- var grademajorIDList = specialtyPlanViewList.Select(x => x.GrademajorID).Distinct().ToList();
- //查询对应的执行计划信息executablePlanList(暂时只匹配年级专业ID)
- var executablePlanList = ExecutablePlanDAL.ExecutablePlanRepository
- .GetList(x => grademajorIDList.Contains(x.GrademajorID), (x => x.EM_ExecutablePlanTeachingSetting)).ToList();
- int success = 0; //成功
- int fail = 0; //失败
- string tipMessage = null; //提示消息
- List<EM_ExecutablePlan> newExecutablePlanInList = new List<EM_ExecutablePlan>();
- List<EM_ExecutablePlanProfile> newProfileInList = new List<EM_ExecutablePlanProfile>();
- List<EM_ExecutablePlanTeachingSetting> newTeachingSettingInList = new List<EM_ExecutablePlanTeachingSetting>();
- List<EM_ExecutablePlanTeachingModeType> newTeachingModeTypeInList = new List<EM_ExecutablePlanTeachingModeType>();
- List<EM_ExecutablePlanTeachingPlace> newTeachingPlaceInList = new List<EM_ExecutablePlanTeachingPlace>();
- foreach (var specialtyPlanView in specialtyPlanViewList)
- {
- //判断对应的学年学期信息
- if (specialtyPlanView.Value < specialtyPlanView.StartValue)
- {
- //表示学年学期小于入学学年学期
- fail++;
- }
- else
- {
- if (specialtyPlanView.Value > specialtyPlanView.GraduatingSemesterValue)
- {
- //表示学年学期大于毕业学年学期
- fail++;
- }
- else
- {
- //查询对应的执行计划信息(根据业务主键:学年学期ID、年级专业ID、课程信息ID)
- var executablePlan = executablePlanList.Where(x => x.SchoolyearID == specialtyPlanView.SchoolyearID
- && x.GrademajorID == specialtyPlanView.GrademajorID
- && x.CoursematerialID == specialtyPlanView.CoursematerialID).SingleOrDefault();
- if (executablePlan == null)
- {
- //表示新增
- var newExecutablePlan = new EM_ExecutablePlan();
- newExecutablePlan.ExecutablePlanID = Guid.NewGuid();
- //来源专业计划默认为必修课
- newExecutablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
- newExecutablePlan.DefaultClassName = specialtyPlanView.CourseName + "-" + specialtyPlanView.GrademajorName;
- newExecutablePlan.SpecialtyPlanID = specialtyPlanView.SpecialtyPlanID;
- newExecutablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- newExecutablePlan.GrademajorID = specialtyPlanView.GrademajorID;
- newExecutablePlan.CoursematerialID = specialtyPlanView.CoursematerialID;
- newExecutablePlan.CourseStructureID = specialtyPlanView.CourseStructureID;
- newExecutablePlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
- newExecutablePlan.CourseTypeID = specialtyPlanView.CourseTypeID;
- newExecutablePlan.CourseQualityID = specialtyPlanView.CourseQualityID;
- newExecutablePlan.DepartmentID = specialtyPlanView.DepartmentID;
- newExecutablePlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
- newExecutablePlan.ResultTypeID = specialtyPlanView.ResultTypeID;
- newExecutablePlan.HandleModeID = specialtyPlanView.HandleModeID;
- newExecutablePlan.Remark = specialtyPlanView.Remark;
- SetNewStatus(newExecutablePlan, (int)EM_ExecuteStatus.NotSubmited);
- newExecutablePlanInList.Add(newExecutablePlan);
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = newExecutablePlan.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);
- var newTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newTeachingSetting.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newTeachingSetting.Credit = specialtyPlanView.Credit;
- newTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- newTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- newTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- newTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- newTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- newTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- newTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- newTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- newTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- newTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- newTeachingSettingInList.Add(newTeachingSetting);
- if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- foreach (var newModeType in specialtyPlanView.TeachingModeIDList.ToList())
- {
- var newTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newTeachingModeType.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newTeachingModeType);
- newTeachingModeTypeInList.Add(newTeachingModeType);
- }
- }
- if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- foreach (var newPlace in specialtyPlanView.TeachingPlaceIDList.ToList())
- {
- var newTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newTeachingPlace.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newTeachingPlace);
- newTeachingPlaceInList.Add(newTeachingPlace);
- }
- }
- success++;
- }
- else
- {
- //表示已存在相同的执行计划信息
- fail++;
- }
- }
- }
- }
- //事务提交
- using (TransactionScope ts = new TransactionScope())
- {
- //批量插入
- UnitOfWork.BulkInsert(newExecutablePlanInList);
- UnitOfWork.BulkInsert(newProfileInList);
- UnitOfWork.BulkInsert(newTeachingSettingInList);
- UnitOfWork.BulkInsert(newTeachingModeTypeInList);
- UnitOfWork.BulkInsert(newTeachingPlaceInList);
- ts.Complete();
- }
- if (success > 0 && fail <= 0)
- {
- tipMessage = success + "条";
- }
- else
- {
- tipMessage = success + "条,失败" + fail + "条,原因:学年学期小于入学学年学期、学年学期大于毕业学年学期或已存在相同的执行计划信息,请检查";
- }
- return tipMessage;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询对应的未新增专业计划信息SpecialtyPlanView
- /// 注:区分普教版本(年级专业)、成教版本(入学学年学期、专业信息)
- /// 注:默认为普教版本(年级专业)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="grademajorID"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="teachingModeID"></param>
- /// <param name="handleModeID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public virtual IGridResultSet<SpecialtyPlanView> GetSpecialtyPlanViewNoAddGrid(ConfiguretView configuretView, Guid? schoolyearID,
- Guid? campusID, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
- Guid? grademajorID, Guid? coursematerialID, int? teachingModeID, int? handleModeID, int pageIndex, int pageSize)
- {
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.SchoolyearID == schoolyearID);
- }
- if (grademajorID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.GrademajorID == grademajorID);
- }
- if (coursematerialID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
- }
- if (handleModeID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.HandleModeID == handleModeID);
- }
- //年级专业
- Expression<Func<CF_Grademajor, bool>> expGrademajor = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (yearID.HasValue)
- {
- expGrademajor = expGrademajor.And(x => x.GradeID == yearID);
- }
- if (grademajorID.HasValue)
- {
- expGrademajor = expGrademajor.And(x => x.GrademajorID == grademajorID);
- }
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.SchoolyearID == schoolyearID);
- }
- if (grademajorID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.GrademajorID == grademajorID);
- }
- if (coursematerialID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.CoursematerialID == coursematerialID);
- }
- var query = ExecutablePlanDAL.GetSpecialtyPlanViewNoAddQueryable(expSpecialtyPlan, expGrademajor, expStudent, expExecutablePlan);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (standardID.HasValue)
- {
- query = query.Where(x => x.StandardID == standardID);
- }
- if (educationID.HasValue)
- {
- query = query.Where(x => x.EducationID == educationID);
- }
- if (learningformID.HasValue)
- {
- query = query.Where(x => x.LearningformID == learningformID);
- }
- if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(learnSystem);
- query = query.Where(x => x.LearnSystem == LearnSystems);
- }
- if (teachingModeID.HasValue)
- {
- //授课方式
- query = query.Where(x => x.TeachingModeIDList.Contains(teachingModeID));
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query)
- .OrderBy(x => x.GrademajorCode.Length).ThenBy(x => x.GrademajorCode)
- .ThenBy(x => x.Value).ThenBy(x => x.CourseTypeID)
- .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
- .ToGridResultSet<SpecialtyPlanView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询对应的未新增专业计划信息List
- /// 注:区分普教版本(年级专业)、成教版本(入学学年学期、专业信息)
- /// 注:默认为普教版本(年级专业)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="grademajorID"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="teachingModeID"></param>
- /// <param name="handleModeID"></param>
- /// <returns></returns>
- public virtual IList<SpecialtyPlanView> GetSpecialtyPlanViewNoAddList(ConfiguretView configuretView, Guid? schoolyearID,
- Guid? campusID, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
- Guid? grademajorID, Guid? coursematerialID, int? teachingModeID, int? handleModeID)
- {
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.SchoolyearID == schoolyearID);
- }
- if (grademajorID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.GrademajorID == grademajorID);
- }
- if (coursematerialID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
- }
- if (handleModeID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.HandleModeID == handleModeID);
- }
- //年级专业
- Expression<Func<CF_Grademajor, bool>> expGrademajor = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (yearID.HasValue)
- {
- expGrademajor = expGrademajor.And(x => x.GradeID == yearID);
- }
- if (grademajorID.HasValue)
- {
- expGrademajor = expGrademajor.And(x => x.GrademajorID == grademajorID);
- }
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.SchoolyearID == schoolyearID);
- }
- if (grademajorID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.GrademajorID == grademajorID);
- }
- if (coursematerialID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.CoursematerialID == coursematerialID);
- }
- var query = ExecutablePlanDAL.GetSpecialtyPlanViewNoAddQueryable(expSpecialtyPlan, expGrademajor, expStudent, expExecutablePlan);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (standardID.HasValue)
- {
- query = query.Where(x => x.StandardID == standardID);
- }
- if (educationID.HasValue)
- {
- query = query.Where(x => x.EducationID == educationID);
- }
- if (learningformID.HasValue)
- {
- query = query.Where(x => x.LearningformID == learningformID);
- }
- if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(learnSystem);
- query = query.Where(x => x.LearnSystem == LearnSystems);
- }
- if (teachingModeID.HasValue)
- {
- //授课方式
- query = query.Where(x => x.TeachingModeIDList.Contains(teachingModeID));
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query)
- .OrderBy(x => x.GrademajorCode.Length).ThenBy(x => x.GrademajorCode)
- .ThenBy(x => x.Value).ThenBy(x => x.CourseTypeID)
- .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode).ToList();
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="executablePlanIDs"></param>
- /// <returns></returns>
- public bool ExecutablePlanDelete(List<Guid?> executablePlanIDs)
- {
- try
- {
- using (TransactionScope ts = new TransactionScope())
- {
- UnitOfWork.Delete<EM_ExecutablePlanTeachingPlace>(x => executablePlanIDs.Contains(x.ExecutablePlanID));
- UnitOfWork.Delete<EM_ExecutablePlanTeachingModeType>(x => executablePlanIDs.Contains(x.ExecutablePlanID));
- UnitOfWork.Delete<EM_ExecutablePlanTeachingSetting>(x => executablePlanIDs.Contains(x.ExecutablePlanID));
- UnitOfWork.Delete<EM_ExecutablePlanProfile>(x => executablePlanIDs.Contains(x.ExecutablePlanID));
- UnitOfWork.Delete<EM_ExecutablePlan>(x => executablePlanIDs.Contains(x.ExecutablePlanID));
- ts.Complete();
- return true;
- }
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 执行计划提交
- /// 注:刷新相关的教学任务信息
- /// 注:区分普教版本(年级专业)、成教版本(入学学年学期、专业信息)
- /// 注:默认为普教版本(年级专业)
- /// 注:此版本学生人数小于等于0时,也可提交,同时也需进一步优化逻辑(对教学任务班学生名单进行判断)
- /// </summary>
- /// <param name="executablePlanIDList"></param>
- /// <returns></returns>
- public virtual string ExecutablePlanSubmit(List<Guid?> executablePlanIDList)
- {
- try
- {
- //教学任务班生成规则如下:
- //1、对应的授课方式为必选项且可多选;
- //2、课程信息对应的上课类型为空时,默认只生成一种类型的教学任务班(授课方式为最小Value授课方式);
- //3、以上课类型为标准,匹配对应的授课方式来生成教学任务班;
- //4、根据授课方式与上课类型查询是否分班情况,存在分班情况,则生成对应的教学任务班;
- //5、对应的授课方式存在分班情况时,默认生成成绩合并录入形式的教学任务班(同一条教学任务);
- //6、年级专业对应的计划范围不于等于0时,不生成对应的教学任务班(无法生成);
- //7、年级专业对应的学生人数小于等于0时,不生成对应的教学任务班(成教版本有此逻辑);;
- //8、如对应的年级专业有多个班级,都生成对应的教学任务班(只取在校状态为在校的学生信息);
- //查询对应的执行计划信息executablePlanViewList
- var executablePlanViewList = ExecutablePlanDAL.GetExecutablePlanViewQueryable(x => executablePlanIDList.Contains(x.ExecutablePlanID)).ToList();
- //查询对应的年级专业IDList
- var grademajorIDList = executablePlanViewList.Select(x => x.GrademajorID).Distinct().ToList();
- //查询对应的班级范围信息classmajorList
- var classmajorList = ExecutablePlanDAL.GetClassmajorRangeQueryable(x => grademajorIDList.Contains(x.GrademajorID)).ToList();
- //查询对应的学生范围信息studentList
- var studentList = ExecutablePlanDAL.GetStudentRangeQueryable(x => grademajorIDList.Contains(x.GrademajorID)).ToList();
- //查询对应在校状态IDList
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- //查询对应的教学任务班信息(业务主键:学年学期ID、课程信息ID、班级信息ID、教学任务班ID或排课任务班ID)
- var educationMissionClassList = ExecutablePlanDAL.GetEducationMissionClassQueryable(x => executablePlanIDList.Contains(x.ExecutablePlanID)).ToList();
- //查询授课方式teachingModeList
- var teachingModeList = DictionaryHelper.GetDictionaryValue(EMIS.ViewModel.DictionaryItem.CF_TeachingMode).ToList();
- int success = 0; //成功
- int fail = 0; //失败
- bool isEpPass = true; //提交成功判断标识
- string tipMessage = null; //提示消息
- List<EM_EducationMission> newEducationMissionInList = new List<EM_EducationMission>();
- List<EM_EducationMission> newEducationMissionUpList = new List<EM_EducationMission>();
- List<EM_EducationMissionClass> newEducationMissionClassInList = new List<EM_EducationMissionClass>();
- List<EM_EducationMissionClass> newEducationMissionClassUpList = new List<EM_EducationMissionClass>();
- List<EM_EducationMissionClassTeachingSetting> newEduTeachingSettingInList = new List<EM_EducationMissionClassTeachingSetting>();
- List<EM_EducationMissionClassTeachingSetting> newEduTeachingSettingUpList = new List<EM_EducationMissionClassTeachingSetting>();
- List<EM_EducationSchedulingClass> newEducationSchedulingClassInList = new List<EM_EducationSchedulingClass>();
- List<EM_EducationMissionClassSettings> newEduSettingsInList = new List<EM_EducationMissionClassSettings>();
- List<EM_CourseProcess> newCourseProcessInList = new List<EM_CourseProcess>();
- List<Guid?> executablePlanIDUpList = new List<Guid?>();
- foreach (var executablePlanView in executablePlanViewList)
- {
- //执行计划对应的授课方式判断
- if (executablePlanView.TeachingModeIDList != null && executablePlanView.TeachingModeIDList.Count() > 0)
- {
- //查询对应的班级范围信息epClassmajorList
- var epClassmajorList = classmajorList.Where(x => x.GrademajorID == executablePlanView.GrademajorID).ToList();
- //执行计划对应的计划范围判断
- if (epClassmajorList != null && epClassmajorList.Count() > 0)
- {
- //查询对应的班级信息epClassmajorIDList
- var epClassmajorIDList = epClassmajorList.Select(x => x.ClassmajorID).ToList();
- //查询对应的学生范围信息studentList
- var epStudentList = studentList.Where(x => epClassmajorIDList.Contains(x.ClassmajorID.Value)).ToList();
- ////执行计划对应的学生范围判断
- //if (epStudentList != null && epStudentList.Count() > 0)
- //{
-
- //}
- //else
- //{
- // //表示执行计划对应的学生范围不存在(小于等于0)
- // isEpPass = false;
- //}
- //查询对应的课程信息中授课方式分班信息List
- var separateModeTypeList = ExecutablePlanDAL.GetSeparateModeTypeQueryble(x => x.CoursematerialID == executablePlanView.CoursematerialID).ToList();
- //查询执行计划中授课方式及对应的上课类型中的授课方式(匹配上课类型)
- var minTeachingModeID = executablePlanView.TeachingModeIDList.Where(x => !separateModeTypeList.Contains(x)).OrderBy(x => x).FirstOrDefault();
- List<int?> teachingModeIDList = new List<int?>();
- if (minTeachingModeID != null)
- {
- teachingModeIDList.Add(minTeachingModeID);
- teachingModeIDList = teachingModeIDList.Concat(executablePlanView.TeachingModeIDList.Where(x => separateModeTypeList.Contains(x))).GroupBy(x => x).Select(x => x.Key).ToList();
- }
- else
- {
- teachingModeIDList = executablePlanView.TeachingModeIDList.Where(x => separateModeTypeList.Contains(x)).GroupBy(x => x).Select(x => x.Key).ToList();
- }
- //查询对应的授课方式信息List(匹配上课类型)
- var epTeachingModeList = teachingModeList.Where(x => teachingModeIDList.Contains(x.Value)).ToList();
- //查询对应的教学任务信息(业务主键:学年学期ID、课程信息ID、班级信息ID、排课任务班ID或教学任务班ID)
- var epEducationMissionClassList = educationMissionClassList
- .Where(x => x.EM_EducationMission.SchoolyearID == executablePlanView.SchoolyearID
- && x.CoursematerialID == executablePlanView.CoursematerialID
- && x.CF_Classmajor.Any(w => epClassmajorIDList.Contains(w.ClassmajorID))).ToList();
- foreach (var classmajor in epClassmajorList)
- {
- //查询班级信息对应的教学任务班信息List
- var educlList = epEducationMissionClassList.Where(x => x.CF_Classmajor.Any(w => w.ClassmajorID == classmajor.ClassmajorID)).ToList();
- if (educlList != null && educlList.Count() > 0)
- {
- //表示存在对应的教学任务班
- //根据教学任务ID对educlList进行分组
- var edugrList = educlList.GroupBy(x => x.EducationMissionID).ToList();
- //根据授课方式对educlList进行分组
- var tmgrList = educlList.GroupBy(x => x.TeachingModeID).ToList();
- if (edugrList.Count() > 1 && tmgrList.Count() > 1)
- {
- //表示对应的教学任务班存在分班且成绩分开录入、授课方式多种情况
- //目前此种数据有误,在生成期末设定时有问题(这里暂不处理)
- isEpPass = false;
- //终止此循环,提交下一个执行计划信息
- break;
- }
- else if (edugrList.Count() > 1 && epTeachingModeList.Count() > 1)
- {
- //表示对应的教学任务班存在分班且成绩分开录入、授课方式只有一种情况,不可再生成多种授课方式的教学任务班信息
- //目前此种数据有误,在生成期末设定时有问题
- isEpPass = false;
- //终止此循环,提交下一个执行计划信息
- break;
- }
- else if (tmgrList.Count() == 1 && epTeachingModeList.Count() == 1)
- {
- //表示对应的教学任务班只存在一种授课方式信息(含分班且成绩合并或分开录入)
- //同时生成的教学任务班信息授课方式只有一种的情况(直接修改)
- foreach (var educl in educlList)
- {
- if (!newEducationMissionUpList.Any(x => x.EducationMissionID == educl.EducationMissionID))
- {
- educl.EM_EducationMission.ClassName = executablePlanView.CourseName + "-" + classmajor.Name;
- educl.EM_EducationMission.SchoolyearID = executablePlanView.SchoolyearID;
- educl.EM_EducationMission.CollegeID = executablePlanView.CollegeID;
- educl.EM_EducationMission.DepartmentID = executablePlanView.DepartmentID;
- SetModifyStatus(educl.EM_EducationMission);
- newEducationMissionUpList.Add(educl.EM_EducationMission);
- }
- if (!newEducationMissionClassUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- educl.CoursematerialID = executablePlanView.CoursematerialID;
- educl.CourseStructureID = executablePlanView.CourseStructureID;
- educl.CourseCategoryID = executablePlanView.CourseCategoryID;
- educl.CourseTypeID = executablePlanView.CourseTypeID;
- educl.CourseQualityID = executablePlanView.CourseQualityID;
- educl.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- educl.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- educl.ExaminationModeID = executablePlanView.ExaminationModeID;
- educl.ResultTypeID = executablePlanView.ResultTypeID;
- educl.HandleModeID = executablePlanView.HandleModeID;
- educl.TeachingModeID = epTeachingModeList[0].Value;
- SetModifyStatus(educl);
- newEducationMissionClassUpList.Add(educl);
- }
- if (!newEduTeachingSettingUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.EM_EducationMissionClassTeachingSetting.Credit = executablePlanView.Credit;
- educl.EM_EducationMissionClassTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- educl.EM_EducationMissionClassTeachingSetting.Practicehours = executablePlanView.Practicehours;
- educl.EM_EducationMissionClassTeachingSetting.Trialhours = executablePlanView.Trialhours;
- //if (educl.RecordStatus != (int)EM_EducationMissionClassStatus.Submitted || educl.RecordStatus != (int)EM_EducationMissionClassStatus.Scheduled)
- //{
- // //暂不考虑
- // educl.EM_EducationMissionClassTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- //}
- newEduTeachingSettingUpList.Add(educl.EM_EducationMissionClassTeachingSetting);
- }
- }
- }
- else
- {
- //表示无论分班与否,成绩都是合并录入的情况(同一个教学任务ID)
- //表示可根据执行计划中匹配上课类型后的授课方式进行增加、修改对应的教学任务班信息
- foreach (var educl in educlList)
- {
- //修改
- if (!newEducationMissionUpList.Any(x => x.EducationMissionID == educl.EducationMissionID))
- {
- educl.EM_EducationMission.ClassName = executablePlanView.CourseName + "-" + classmajor.Name;
- educl.EM_EducationMission.SchoolyearID = executablePlanView.SchoolyearID;
- educl.EM_EducationMission.CollegeID = executablePlanView.CollegeID;
- educl.EM_EducationMission.DepartmentID = executablePlanView.DepartmentID;
- SetModifyStatus(educl.EM_EducationMission);
- newEducationMissionUpList.Add(educl.EM_EducationMission);
- }
- if (!newEducationMissionClassUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- educl.CoursematerialID = executablePlanView.CoursematerialID;
- educl.CourseStructureID = executablePlanView.CourseStructureID;
- educl.CourseCategoryID = executablePlanView.CourseCategoryID;
- educl.CourseTypeID = executablePlanView.CourseTypeID;
- educl.CourseQualityID = executablePlanView.CourseQualityID;
- educl.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- educl.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- educl.ExaminationModeID = executablePlanView.ExaminationModeID;
- educl.ResultTypeID = executablePlanView.ResultTypeID;
- educl.HandleModeID = executablePlanView.HandleModeID;
- SetModifyStatus(educl);
- newEducationMissionClassUpList.Add(educl);
- }
- if (!newEduTeachingSettingUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.EM_EducationMissionClassTeachingSetting.Credit = executablePlanView.Credit;
- educl.EM_EducationMissionClassTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- educl.EM_EducationMissionClassTeachingSetting.Practicehours = executablePlanView.Practicehours;
- educl.EM_EducationMissionClassTeachingSetting.Trialhours = executablePlanView.Trialhours;
- //if (educl.RecordStatus != (int)EM_EducationMissionClassStatus.Submitted || educl.RecordStatus != (int)EM_EducationMissionClassStatus.Scheduled)
- //{
- // //暂不考虑
- // educl.EM_EducationMissionClassTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- //}
- newEduTeachingSettingUpList.Add(educl.EM_EducationMissionClassTeachingSetting);
- }
- }
- //将执行计划中匹配上课类型后的授课方式与对应的教学任务班的授课方式进行对比
- var educltmList = tmgrList.Select(x => x.Key).ToList();
- var newTeachingModeList = epTeachingModeList.Where(x => !educltmList.Contains(x.Value)).ToList();
- foreach (var newTeachingMode in newTeachingModeList)
- {
- //新增
- var newEducationMissionClass = new EM_EducationMissionClass();
- newEducationMissionClass.EducationMissionClassID = Guid.NewGuid();
- newEducationMissionClass.EducationMissionID = edugrList[0].Key;
- newEducationMissionClass.MainScheduleClassID = classmajor.ClassmajorID;
- newEducationMissionClass.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- newEducationMissionClass.OrderNo = classmajor.ClassNum ?? 1;
- newEducationMissionClass.Name = executablePlanView.CourseName + "-" + classmajor.Name + "-(" + newTeachingMode.Name + ")";
- newEducationMissionClass.CoursematerialID = executablePlanView.CoursematerialID;
- newEducationMissionClass.CourseStructureID = executablePlanView.CourseStructureID;
- newEducationMissionClass.CourseCategoryID = executablePlanView.CourseCategoryID;
- newEducationMissionClass.CourseTypeID = executablePlanView.CourseTypeID;
- newEducationMissionClass.CourseQualityID = executablePlanView.CourseQualityID;
- newEducationMissionClass.ClassroomTypeID = null;
- newEducationMissionClass.ClassroomID = null;
- newEducationMissionClass.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- newEducationMissionClass.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- newEducationMissionClass.ExaminationModeID = executablePlanView.ExaminationModeID;
- newEducationMissionClass.ResultTypeID = executablePlanView.ResultTypeID;
- newEducationMissionClass.HandleModeID = executablePlanView.HandleModeID;
- newEducationMissionClass.TeachingModeID = newTeachingMode.Value;
- newEducationMissionClass.Remark = executablePlanView.CourseName + "-" + classmajor.Name + "-(" + newTeachingMode.Name + ")";
- SetNewStatus(newEducationMissionClass, (int)EM_EducationMissionClassStatus.NotSubmitted);
- newEducationMissionClassInList.Add(newEducationMissionClass);
- var newEduTeachingSetting = new EM_EducationMissionClassTeachingSetting();
- newEduTeachingSetting.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduTeachingSetting.Credit = executablePlanView.Credit;
- newEduTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- newEduTeachingSetting.Practicehours = executablePlanView.Practicehours;
- newEduTeachingSetting.Trialhours = executablePlanView.Trialhours;
- newEduTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- newEduTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- newEduTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- newEduTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- newEduTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- newEduTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- newEduTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEduTeachingSettingInList.Add(newEduTeachingSetting);
- newEducationMissionClass.CF_Classmajor = new HashSet<CF_Classmajor>();
- newEducationMissionClass.CF_Classmajor.Add(classmajor);
- var newEducationSchedulingClass = new EM_EducationSchedulingClass();
- newEducationSchedulingClass.EducationSchedulingClassID = Guid.NewGuid();
- newEducationSchedulingClass.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationSchedulingClass.TaskGroupName = "1组";
- newEducationSchedulingClass.Remark = classmajor.Name;
- SetNewStatus(newEducationSchedulingClass);
- newEducationSchedulingClassInList.Add(newEducationSchedulingClass);
- newEducationSchedulingClass.CF_Student = new HashSet<CF_Student>();
- var newStudent = studentList.Where(x => x.ClassmajorID == classmajor.ClassmajorID && inschoolStatusList.Contains(x.InSchoolStatusID)).ToList();
- newStudent.ForEach(x => newEducationSchedulingClass.CF_Student.Add(x));
- //for (int i = 0; i < executablePlanView.EndWeeklyNum; i++)
- //{
- // var newEduSettings = new EM_EducationMissionClassSettings();
- // newEduSettings.EducationMissionClassSettingsID = Guid.NewGuid();
- // newEduSettings.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- // newEduSettings.WeeklyNum = i + 1;
- // SetNewStatus(newEduSettings);
- // newEduSettingsInList.Add(newEduSettings);
- // var newCourseProcess = new EM_CourseProcess();
- // newCourseProcess.CourseProcessID = Guid.NewGuid();
- // newCourseProcess.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- // newCourseProcess.Week = i + 1;
- // newCourseProcess.Times = executablePlanView.WeeklyHours;
- // newCourseProcessInList.Add(newCourseProcess);
- //}
- }
- }
- }
- else
- {
- //表示不存在对应的教学任务班(新增)
- var newEducationMission = new EM_EducationMission();
- newEducationMission.EducationMissionID = Guid.NewGuid();
- newEducationMission.ClassName = executablePlanView.CourseName + "-" + classmajor.Name;
- newEducationMission.SchoolyearID = executablePlanView.SchoolyearID;
- newEducationMission.CollegeID = executablePlanView.CollegeID;
- newEducationMission.DepartmentID = executablePlanView.DepartmentID;
- SetNewStatus(newEducationMission);
- newEducationMissionInList.Add(newEducationMission);
- foreach (var epTeachingMode in epTeachingModeList)
- {
- var newEducationMissionClass = new EM_EducationMissionClass();
- newEducationMissionClass.EducationMissionClassID = Guid.NewGuid();
- newEducationMissionClass.EducationMissionID = newEducationMission.EducationMissionID;
- newEducationMissionClass.MainScheduleClassID = classmajor.ClassmajorID;
- newEducationMissionClass.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- newEducationMissionClass.OrderNo = classmajor.ClassNum ?? 1;
- newEducationMissionClass.Name = executablePlanView.CourseName + "-" + classmajor.Name + "-(" + epTeachingMode.Name + ")";
- newEducationMissionClass.CoursematerialID = executablePlanView.CoursematerialID;
- newEducationMissionClass.CourseStructureID = executablePlanView.CourseStructureID;
- newEducationMissionClass.CourseCategoryID = executablePlanView.CourseCategoryID;
- newEducationMissionClass.CourseTypeID = executablePlanView.CourseTypeID;
- newEducationMissionClass.CourseQualityID = executablePlanView.CourseQualityID;
- newEducationMissionClass.ClassroomTypeID = null;
- newEducationMissionClass.ClassroomID = null;
- newEducationMissionClass.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- newEducationMissionClass.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- newEducationMissionClass.ExaminationModeID = executablePlanView.ExaminationModeID;
- newEducationMissionClass.ResultTypeID = executablePlanView.ResultTypeID;
- newEducationMissionClass.HandleModeID = executablePlanView.HandleModeID;
- newEducationMissionClass.TeachingModeID = epTeachingMode.Value;
- newEducationMissionClass.Remark = executablePlanView.CourseName + "-" + classmajor.Name + "-(" + epTeachingMode.Name + ")";
- SetNewStatus(newEducationMissionClass, (int)EM_EducationMissionClassStatus.NotSubmitted);
- newEducationMissionClassInList.Add(newEducationMissionClass);
- var newEduTeachingSetting = new EM_EducationMissionClassTeachingSetting();
- newEduTeachingSetting.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduTeachingSetting.Credit = executablePlanView.Credit;
- newEduTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- newEduTeachingSetting.Practicehours = executablePlanView.Practicehours;
- newEduTeachingSetting.Trialhours = executablePlanView.Trialhours;
- newEduTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- newEduTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- newEduTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- newEduTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- newEduTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- newEduTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- newEduTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEduTeachingSettingInList.Add(newEduTeachingSetting);
- newEducationMissionClass.CF_Classmajor = new HashSet<CF_Classmajor>();
- newEducationMissionClass.CF_Classmajor.Add(classmajor);
- var newEducationSchedulingClass = new EM_EducationSchedulingClass();
- newEducationSchedulingClass.EducationSchedulingClassID = Guid.NewGuid();
- newEducationSchedulingClass.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationSchedulingClass.TaskGroupName = "1组";
- newEducationSchedulingClass.Remark = classmajor.Name;
- SetNewStatus(newEducationSchedulingClass);
- newEducationSchedulingClassInList.Add(newEducationSchedulingClass);
- newEducationSchedulingClass.CF_Student = new HashSet<CF_Student>();
- var newStudent = studentList.Where(x => x.ClassmajorID == classmajor.ClassmajorID && inschoolStatusList.Contains(x.InSchoolStatusID)).ToList();
- newStudent.ForEach(x => newEducationSchedulingClass.CF_Student.Add(x));
- //for (int i = 0; i < executablePlanView.EndWeeklyNum; i++)
- //{
- // var newEduSettings = new EM_EducationMissionClassSettings();
- // newEduSettings.EducationMissionClassSettingsID = Guid.NewGuid();
- // newEduSettings.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- // newEduSettings.WeeklyNum = i + 1;
- // SetNewStatus(newEduSettings);
- // newEduSettingsInList.Add(newEduSettings);
- // var newCourseProcess = new EM_CourseProcess();
- // newCourseProcess.CourseProcessID = Guid.NewGuid();
- // newCourseProcess.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- // newCourseProcess.Week = i + 1;
- // newCourseProcess.Times = executablePlanView.WeeklyHours;
- // newCourseProcessInList.Add(newCourseProcess);
- //}
- }
- }
- }
- }
- else
- {
- //表示执行计划对应的计划范围不存在(小于等于0)
- isEpPass = false;
- }
- }
- else
- {
- //表示执行计划对应的授课方式为空
- isEpPass = false;
- }
- if (isEpPass)
- {
- //表示提交成功
- executablePlanIDUpList.Add(executablePlanView.ExecutablePlanID);
- success++;
- }
- else
- {
- //表示提交失败
- fail++;
- isEpPass = true;
- }
- }
- //更新提交成功的执行计划的状态
- var newExecutablePlanUpList = ExecutablePlanDAL.ExecutablePlanRepository.GetList(x => executablePlanIDUpList.Contains(x.ExecutablePlanID)).ToList();
- newExecutablePlanUpList.ForEach(x =>
- {
- x.RecordStatus = (int)EM_ExecuteStatus.Submited;
- SetModifyStatus(x);
- });
- using (TransactionScope ts = new TransactionScope())
- {
- UnitOfWork.BulkInsert(newEducationMissionInList);
- UnitOfWork.BulkInsert(newEducationMissionClassInList);
- UnitOfWork.BulkInsert(newEduTeachingSettingInList);
- UnitOfWork.BulkInsert(newEducationMissionClassInList, (x => x.CF_Classmajor));
- UnitOfWork.BulkInsert(newEducationSchedulingClassInList);
- UnitOfWork.BulkInsert(newEducationSchedulingClassInList, (x => x.CF_Student));
- UnitOfWork.BulkInsert(newEduSettingsInList);
- UnitOfWork.BulkInsert(newCourseProcessInList);
- if (newEducationMissionUpList != null && newEducationMissionUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEducationMissionUpList);
- }
- if (newEducationMissionClassUpList != null && newEducationMissionClassUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEducationMissionClassUpList);
- }
- if (newEduTeachingSettingUpList != null && newEduTeachingSettingUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEduTeachingSettingUpList);
- }
- if (newExecutablePlanUpList != null && newExecutablePlanUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newExecutablePlanUpList);
- }
- ts.Complete();
- }
- if (success > 0 && fail <= 0)
- {
- tipMessage = success + "条";
- }
- else
- {
- //暂时不提示此消息(存在分班且成绩分开录入同时授课方式多种或存在分班且成绩分开录入同时生成多种授课方式的教学任务班信息(请删除后,再提交))
- tipMessage = success + "条,失败" + fail + "条,原因:数据有误,请检查(授课方式为空或执行计划范围为0等)";
- }
- return tipMessage;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询执行计划对应的授课方式List
- /// </summary>
- /// <param name="executablePlanID"></param>
- /// <returns></returns>
- public List<string> GetTeachingModeTypeList(Guid? executablePlanID)
- {
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- exp = exp.And(x => x.ExecutablePlanID == executablePlanID);
- var query = ExecutablePlanDAL.GetTeachingModeTypeQueryble(exp);
- return query.OrderBy(x => x.Value).Select(x => x.ToString()).ToList();
- }
- /// <summary>
- /// 查询执行计划对应的授课地点List
- /// </summary>
- /// <param name="executablePlanID"></param>
- /// <returns></returns>
- public List<string> GetTeachingPlaceList(Guid? executablePlanID)
- {
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- exp = exp.And(x => x.ExecutablePlanID == executablePlanID);
- var query = ExecutablePlanDAL.GetTeachingPlaceQueryble(exp);
- return query.OrderBy(x => x.Value).Select(x => x.ToString()).ToList();
- }
- /// <summary>
- /// 查询执行计划对应的计划范围信息ClassmajorView
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="executablePlanID"></param>
- /// <param name="classmajorID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<ClassmajorView> GetPlanRangeViewGrid(ConfiguretView configuretView, Guid? executablePlanID,
- Guid? classmajorID, int? inSchoolStatus, int pageIndex, int pageSize)
- {
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expExecutablePlan = expExecutablePlan.And(x => x.ExecutablePlanID == executablePlanID);
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus.HasValue)
- {
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.Yes)
- {
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.No)
- {
- //不在校
- expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- var query = ExecutablePlanDAL.GetPlanRangeViewQueryable(expExecutablePlan, expStudent);
- if (classmajorID.HasValue)
- {
- query = query.Where(x => x.ClassmajorID == classmajorID);
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return query.OrderBy(x => x.CollegeCode.Length)
- .ThenBy(x => x.CollegeCode).ThenBy(x => x.StandardID)
- .ThenBy(x => x.No.Length).ThenBy(x => x.No)
- .ThenBy(x => x.ClassNum)
- .ToGridResultSet<ClassmajorView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询执行计划对应的计划范围信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="executablePlanID"></param>
- /// <param name="classmajorID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <returns></returns>
- public IList<ClassmajorView> GetPlanRangeViewList(ConfiguretView configuretView, Guid? executablePlanID,
- Guid? classmajorID, int? inSchoolStatus)
- {
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expExecutablePlan = expExecutablePlan.And(x => x.ExecutablePlanID == executablePlanID);
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus.HasValue)
- {
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.Yes)
- {
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.No)
- {
- //不在校
- expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- var query = ExecutablePlanDAL.GetPlanRangeViewQueryable(expExecutablePlan, expStudent);
- if (classmajorID.HasValue)
- {
- query = query.Where(x => x.ClassmajorID == classmajorID);
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return query.OrderBy(x => x.CollegeCode.Length)
- .ThenBy(x => x.CollegeCode).ThenBy(x => x.StandardID)
- .ThenBy(x => x.No.Length).ThenBy(x => x.No)
- .ThenBy(x => x.ClassNum).ToList();
- }
- /// <summary>
- /// 查询执行计划对应的学生信息BaseStudentView
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="executablePlanID"></param>
- /// <param name="classmajorID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<BaseStudentView> GetBaseStudentViewGrid(ConfiguretView configuretView, Guid? executablePlanID,
- Guid? classmajorID, int? inSchoolStatus, int pageIndex, int pageSize)
- {
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expExecutablePlan = expExecutablePlan.And(x => x.ExecutablePlanID == executablePlanID);
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus.HasValue)
- {
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.Yes)
- {
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.No)
- {
- //不在校
- expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- var query = ExecutablePlanDAL.GetBaseStudentViewQueryable(expExecutablePlan, expStudent);
- if (classmajorID.HasValue)
- {
- query = query.Where(x => x.ClassmajorID == classmajorID);
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return query.OrderBy(x => x.ClassmajorCode.Length)
- .ThenBy(x => x.ClassmajorCode).ThenBy(x => x.LoginID)
- .ToGridResultSet<BaseStudentView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询执行计划对应的学生信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="executablePlanID"></param>
- /// <param name="classmajorID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <returns></returns>
- public IList<BaseStudentView> GetBaseStudentViewList(ConfiguretView configuretView, Guid? executablePlanID,
- Guid? classmajorID, int? inSchoolStatus)
- {
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expExecutablePlan = expExecutablePlan.And(x => x.ExecutablePlanID == executablePlanID);
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus.HasValue)
- {
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.Yes)
- {
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.No)
- {
- //不在校
- expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- var query = ExecutablePlanDAL.GetBaseStudentViewQueryable(expExecutablePlan, expStudent);
- if (classmajorID.HasValue)
- {
- query = query.Where(x => x.ClassmajorID == classmajorID);
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return query.OrderBy(x => x.ClassmajorCode.Length)
- .ThenBy(x => x.ClassmajorCode).ThenBy(x => x.LoginID)
- .ToList();
- }
- /// <summary>
- /// 新增(数据库表,用于报表)
- /// </summary>
- /// <param name="tempTableName"></param>
- /// <param name="ids"></param>
- public void CreateIDTempTable(string tempTableName, List<Guid?> ids)
- {
- try
- {
- UnitOfWork.CreateIDTempTable(tempTableName, ids);
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 删除(数据库表,用于报表)
- /// </summary>
- /// <param name="tempTableName"></param>
- /// <returns></returns>
- public bool DeleteTempTable(string tempTableName)
- {
- try
- {
- UnitOfWork.DeleteTempTable(tempTableName);
- return true;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public IGridResultSet<CoursematerialView> GetLastCoursematerialViewGrid(ConfiguretView configuretView, Guid userID,
- int? pageIndex, int? pageSize)
- {
- Expression<Func<CF_Student, bool>> studentExp = (x => x.UserID == userID);
- var query = this.ExecutablePlanDAL.GetLastCoursematerialViewQueryable(studentExp);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- query = query.OrderBy(x => x.CourseCode).ThenBy(x => x.CourseName);
- return query.ToGridResultSet(pageIndex, pageSize);
- }
- }
- }
|