1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364 |
- 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.CultureplanManage;
- using EMIS.ViewModel.CultureplanManage.PlanManagement;
- using EMIS.ViewModel.Students;
- using EMIS.DataLogic.CultureplanManage.PlanManagement;
- using EMIS.CommonLogic.Students;
- using EMIS.CommonLogic.StudentManage.StudentStatistics;
- using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
- namespace EMIS.CommonLogic.CultureplanManage.PlanManagement
- {
- public class SpecialtyPlanServices : BaseServices, ISpecialtyPlanServices
- {
- public SpecialtyPlanDAL SpecialtyPlanDAL { get; set; }
- public Lazy<IInSchoolSettingServices> InSchoolStatusSettingServices { get; set; }
- /// <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 IGridResultSet<SpecialtyPlanView> GetSpecialtyPlanViewGrid(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_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- var query = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(expSpecialtyPlan, 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 (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 IList<SpecialtyPlanView> GetSpecialtyPlanViewList(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_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- var query = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(expSpecialtyPlan, 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 (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>
- /// 查询对应的专业计划信息SpecialtyPlanView(根据专业计划ID)
- /// </summary>
- /// <param name="specialtyPlanID"></param>
- /// <returns></returns>
- public SpecialtyPlanView GetSpecialtyPlanView(Guid? specialtyPlanID)
- {
- try
- {
- var specialtyPlanView = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(x => x.SpecialtyPlanID == specialtyPlanID).SingleOrDefault();
- return specialtyPlanView;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 编辑(新增、修改,业务主键:学年学期ID、年级专业ID、课程信息ID)
- /// 注:刷新相关的执行计划信息
- /// </summary>
- /// <param name="specialtyPlanView"></param>
- public virtual void SpecialtyPlanEdit(SpecialtyPlanView specialtyPlanView)
- {
- try
- {
- //查询对应的年级专业信息
- var grademajor = SpecialtyPlanDAL.GrademajorRepository.GetList(x => x.GrademajorID == specialtyPlanView.GrademajorID).SingleOrDefault();
- if (grademajor == null)
- {
- throw new Exception("年级专业信息不存在,请检查。");
- }
- //查询年级专业对应的入学学年学期信息
- var startSchoolyear = SpecialtyPlanDAL.SchoolyearRepository.GetList(x => x.Years == grademajor.GradeID
- && x.SchoolcodeID == grademajor.SemesterID).SingleOrDefault();
- if (startSchoolyear == null)
- {
- throw new Exception("年级专业对应的入学学年学期信息不存在,请检查。");
- }
- //查询年级专业对应的毕业学年学期信息
- var graduatingSemester = SpecialtyPlanDAL.SchoolyearRepository
- .GetList(x => x.SchoolyearID == grademajor.GraduateSchoolyearID).SingleOrDefault();
- if (graduatingSemester == null)
- {
- throw new Exception("年级专业对应的毕业学年学期信息不存在,请检查。");
- }
- //查询对应的学年学期信息
- var schoolyear = SpecialtyPlanDAL.SchoolyearRepository
- .GetList(x => x.SchoolyearID == specialtyPlanView.SchoolyearID).SingleOrDefault();
- if (schoolyear == null)
- {
- throw new Exception("学年学期信息不存在,请检查。");
- }
- if (schoolyear.Value < startSchoolyear.Value)
- {
- throw new Exception("学年学期小于入学学年学期,请检查。");
- }
- if (schoolyear.Value > graduatingSemester.Value)
- {
- throw new Exception("学年学期大于毕业学年学期,请检查。");
- }
- //查询数据库进行验证
- var specialtyPlanVerify = SpecialtyPlanDAL.SpecialtyPlanRepository
- .GetList(x => x.SpecialtyPlanID != specialtyPlanView.SpecialtyPlanID
- && x.SchoolyearID == specialtyPlanView.SchoolyearID
- && x.GrademajorID == specialtyPlanView.GrademajorID
- && x.CoursematerialID == specialtyPlanView.CoursematerialID).SingleOrDefault();
- if (specialtyPlanVerify == null)
- {
- List<EM_SpecialtyPlan> newSpecialtyPlanInList = new List<EM_SpecialtyPlan>();
- List<EM_SpecialtyPlan> newSpecialtyPlanUpList = new List<EM_SpecialtyPlan>();
- List<EM_SpecialtyPlanTeachingSetting> newSPTeachingSettingInList = new List<EM_SpecialtyPlanTeachingSetting>();
- List<EM_SpecialtyPlanTeachingSetting> newSPTeachingSettingUpList = new List<EM_SpecialtyPlanTeachingSetting>();
- List<EM_SpecialtyPlanTeachingModeType> newSPTeachingModeTypeInList = new List<EM_SpecialtyPlanTeachingModeType>();
- List<EM_SpecialtyPlanTeachingPlace> newSPTeachingPlaceInList = new List<EM_SpecialtyPlanTeachingPlace>();
- List<Guid?> specialtyPlanTMDelList = new List<Guid?>();
- List<Guid?> specialtyPlanTPDelList = new List<Guid?>();
- List<EM_ExecutablePlan> newExecutablePlanUpList = new List<EM_ExecutablePlan>();
- List<EM_ExecutablePlanProfile> newProfileInList = new List<EM_ExecutablePlanProfile>();
- List<EM_ExecutablePlanProfile> newProfileUpList = new List<EM_ExecutablePlanProfile>();
- List<EM_ExecutablePlanTeachingSetting> newEPTeachingSettingInList = new List<EM_ExecutablePlanTeachingSetting>();
- List<EM_ExecutablePlanTeachingSetting> newEPTeachingSettingUpList = new List<EM_ExecutablePlanTeachingSetting>();
- List<EM_ExecutablePlanTeachingModeType> newEPTeachingModeTypeInList = new List<EM_ExecutablePlanTeachingModeType>();
- List<EM_ExecutablePlanTeachingPlace> newEPTeachingPlaceInList = new List<EM_ExecutablePlanTeachingPlace>();
- List<Guid?> executablePlanTMDelList = new List<Guid?>();
- List<Guid?> executablePlanTPDelList = new List<Guid?>();
- List<Guid> executablePlanIDList = new List<Guid>();
- //数据有误验证
- if (specialtyPlanView.SpecialtyPlanID != Guid.Empty)
- {
- var specialtyPlan = SpecialtyPlanDAL.SpecialtyPlanRepository
- .GetList(x => x.SpecialtyPlanID == specialtyPlanView.SpecialtyPlanID,
- (x => x.EM_SpecialtyPlanTeachingSetting), (x => x.EM_ExecutablePlan)).SingleOrDefault();
- if (specialtyPlan == null)
- {
- throw new Exception("数据有误,请核查。");
- }
- else
- {
- //表示修改
- specialtyPlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- specialtyPlan.GrademajorID = specialtyPlanView.GrademajorID;
- specialtyPlan.CoursematerialID = specialtyPlanView.CoursematerialID;
- specialtyPlan.CourseStructureID = specialtyPlanView.CourseStructureID;
- specialtyPlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
- specialtyPlan.CourseTypeID = specialtyPlanView.CourseTypeID;
- specialtyPlan.CourseQualityID = specialtyPlanView.CourseQualityID;
- specialtyPlan.DepartmentID = specialtyPlanView.DepartmentID;
- specialtyPlan.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- specialtyPlan.IsCooperation = specialtyPlanView.IsCooperation;
- specialtyPlan.IsRequired = specialtyPlanView.IsRequired;
- specialtyPlan.IsElective = specialtyPlanView.IsElective;
- specialtyPlan.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- specialtyPlan.IsMainCourse = specialtyPlanView.IsMainCourse;
- specialtyPlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
- specialtyPlan.CourseFineID = specialtyPlanView.CourseFineID;
- specialtyPlan.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- specialtyPlan.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- specialtyPlan.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- specialtyPlan.ResultTypeID = specialtyPlanView.ResultTypeID;
- specialtyPlan.HandleModeID = specialtyPlanView.HandleModeID;
- specialtyPlan.Remark = specialtyPlanView.Remark;
- SetModifyStatus(specialtyPlan);
- newSpecialtyPlanUpList.Add(specialtyPlan);
- if (specialtyPlan.EM_SpecialtyPlanTeachingSetting == null)
- {
- var newSPTeachingSetting = new EM_SpecialtyPlanTeachingSetting();
- newSPTeachingSetting.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- newSPTeachingSetting.Credit = specialtyPlanView.Credit;
- newSPTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- newSPTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- newSPTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- newSPTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- newSPTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- newSPTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- newSPTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- newSPTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- newSPTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- newSPTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- newSPTeachingSettingInList.Add(newSPTeachingSetting);
- }
- else
- {
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.Credit = specialtyPlanView.Credit;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- specialtyPlan.EM_SpecialtyPlanTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- newSPTeachingSettingUpList.Add(specialtyPlan.EM_SpecialtyPlanTeachingSetting);
- }
- if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- specialtyPlanTMDelList.Add(specialtyPlan.SpecialtyPlanID);
- foreach (var teachingModeID in specialtyPlanView.TeachingModeIDList)
- {
- var newSPTeachingMode = new EM_SpecialtyPlanTeachingModeType();
- newSPTeachingMode.SpecialtyPlanTeachingModeTypeID = Guid.NewGuid();
- newSPTeachingMode.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- newSPTeachingMode.TeachingModeID = teachingModeID;
- SetNewStatus(newSPTeachingMode);
- newSPTeachingModeTypeInList.Add(newSPTeachingMode);
- }
- }
- else
- {
- specialtyPlanTMDelList.Add(specialtyPlan.SpecialtyPlanID);
- }
- if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- specialtyPlanTPDelList.Add(specialtyPlan.SpecialtyPlanID);
- foreach (var teachingPlaceID in specialtyPlanView.TeachingPlaceIDList)
- {
- var newSPTeachingPlace = new EM_SpecialtyPlanTeachingPlace();
- newSPTeachingPlace.SpecialtyPlanTeachingPlaceID = Guid.NewGuid();
- newSPTeachingPlace.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- newSPTeachingPlace.TeachingPlace = teachingPlaceID;
- SetNewStatus(newSPTeachingPlace);
- newSPTeachingPlaceInList.Add(newSPTeachingPlace);
- }
- }
- else
- {
- specialtyPlanTPDelList.Add(specialtyPlan.SpecialtyPlanID);
- }
- //对应的执行计划信息更新(根据业务主键:学年学期ID、年级专业ID、课程信息ID)
- //注:由于相关业务主键冗余且同时存在主外键关联,目前不允许修改相关业务主键
- var executablePlan = SpecialtyPlanDAL.ExecutablePlanRepository.GetList(x => x.SchoolyearID == specialtyPlanView.SchoolyearID
- && x.GrademajorID == specialtyPlanView.GrademajorID
- && x.CoursematerialID == specialtyPlanView.CoursematerialID,
- (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).SingleOrDefault();
- if (executablePlan == null)
- {
- //表示不存在对应的执行计划信息(暂不新增)
- }
- else
- {
- //表示存在对应的执行计划信息(修改)
- executablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
- //暂不考虑
- //executablePlan.DefaultClassName = specialtyPlanView.CourseName + "-" + specialtyPlanView.GrademajorName;
- executablePlan.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- executablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- executablePlan.GrademajorID = specialtyPlanView.GrademajorID;
- executablePlan.CoursematerialID = specialtyPlanView.CoursematerialID;
- executablePlan.CourseStructureID = specialtyPlanView.CourseStructureID;
- executablePlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
- executablePlan.CourseTypeID = specialtyPlanView.CourseTypeID;
- executablePlan.CourseQualityID = specialtyPlanView.CourseQualityID;
- executablePlan.DepartmentID = specialtyPlanView.DepartmentID;
- executablePlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
- executablePlan.ResultTypeID = specialtyPlanView.ResultTypeID;
- executablePlan.HandleModeID = specialtyPlanView.HandleModeID;
- SetModifyStatus(executablePlan);
- newExecutablePlanUpList.Add(executablePlan);
- if (executablePlan.EM_ExecutablePlanProfile == null)
- {
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- newProfile.IsCooperation = specialtyPlanView.IsCooperation;
- newProfile.IsRequired = specialtyPlanView.IsRequired;
- newProfile.IsElective = specialtyPlanView.IsElective;
- newProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- newProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
- newProfile.CourseFineID = specialtyPlanView.CourseFineID;
- newProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- }
- else
- {
- executablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- executablePlan.EM_ExecutablePlanProfile.IsCooperation = specialtyPlanView.IsCooperation;
- executablePlan.EM_ExecutablePlanProfile.IsRequired = specialtyPlanView.IsRequired;
- executablePlan.EM_ExecutablePlanProfile.IsElective = specialtyPlanView.IsElective;
- executablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- executablePlan.EM_ExecutablePlanProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
- executablePlan.EM_ExecutablePlanProfile.CourseFineID = specialtyPlanView.CourseFineID;
- executablePlan.EM_ExecutablePlanProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- executablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- executablePlan.EM_ExecutablePlanProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- SetModifyStatus(executablePlan.EM_ExecutablePlanProfile);
- newProfileUpList.Add(executablePlan.EM_ExecutablePlanProfile);
- }
- if (executablePlan.EM_ExecutablePlanTeachingSetting == null)
- {
- var newEPTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newEPTeachingSetting.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingSetting.Credit = specialtyPlanView.Credit;
- newEPTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- newEPTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- newEPTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- newEPTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- newEPTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- newEPTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- newEPTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- newEPTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- newEPTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- newEPTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- newEPTeachingSettingInList.Add(newEPTeachingSetting);
- }
- else
- {
- //可更新的相关信息
- executablePlan.EM_ExecutablePlanTeachingSetting.Credit = specialtyPlanView.Credit;
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- executablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- executablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- }
- newEPTeachingSettingUpList.Add(executablePlan.EM_ExecutablePlanTeachingSetting);
- }
- if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- //可更新的相关信息
- if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newModeType in specialtyPlanView.TeachingModeIDList.ToList())
- {
- var newEPTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newEPTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newEPTeachingModeType.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newEPTeachingModeType);
- newEPTeachingModeTypeInList.Add(newEPTeachingModeType);
- }
- }
- else
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- }
- }
- if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newPlace in specialtyPlanView.TeachingPlaceIDList.ToList())
- {
- var newEPTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newEPTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newEPTeachingPlace.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newEPTeachingPlace);
- newEPTeachingPlaceInList.Add(newEPTeachingPlace);
- }
- }
- else
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- }
- executablePlanIDList.Add(executablePlan.ExecutablePlanID);
- }
- //存在对应的主外键关联
- if (specialtyPlan.EM_ExecutablePlan.Count() > 0)
- {
- //根据专业计划主键ID查询对应的执行计划信息List
- var newExecutablePlanList = SpecialtyPlanDAL.ExecutablePlanRepository
- .GetList(x => x.SpecialtyPlanID == specialtyPlan.SpecialtyPlanID,
- (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).ToList();
- foreach (var newExecutablePlan in newExecutablePlanList)
- {
- if (!executablePlanIDList.Contains(newExecutablePlan.ExecutablePlanID))
- {
- //查询对应的专业计划信息(业务主键:学年学期ID、年级专业ID、课程信息ID)
- var newSpecialtyPlanView = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(x => x.SpecialtyPlanID != specialtyPlan.SpecialtyPlanID
- && x.SchoolyearID == newExecutablePlan.SchoolyearID
- && x.GrademajorID == newExecutablePlan.GrademajorID
- && x.CoursematerialID == newExecutablePlan.CoursematerialID).SingleOrDefault();
- if (newSpecialtyPlanView == null)
- {
- newExecutablePlan.SpecialtyPlanID = null;
- SetModifyStatus(newExecutablePlan);
- newExecutablePlanUpList.Add(newExecutablePlan);
- }
- else
- {
- //来源专业计划默认为必修课
- newExecutablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
- newExecutablePlan.DefaultClassName = newSpecialtyPlanView.CourseName + "-" + newSpecialtyPlanView.GrademajorName;
- newExecutablePlan.SpecialtyPlanID = newSpecialtyPlanView.SpecialtyPlanID;
- newExecutablePlan.SchoolyearID = newSpecialtyPlanView.SchoolyearID;
- newExecutablePlan.GrademajorID = newSpecialtyPlanView.GrademajorID;
- newExecutablePlan.CoursematerialID = newSpecialtyPlanView.CoursematerialID;
- newExecutablePlan.CourseStructureID = newSpecialtyPlanView.CourseStructureID;
- newExecutablePlan.CourseCategoryID = newSpecialtyPlanView.CourseCategoryID;
- newExecutablePlan.CourseTypeID = newSpecialtyPlanView.CourseTypeID;
- newExecutablePlan.CourseQualityID = newSpecialtyPlanView.CourseQualityID;
- newExecutablePlan.DepartmentID = newSpecialtyPlanView.DepartmentID;
- newExecutablePlan.IsNeedMaterial = newSpecialtyPlanView.IsNeedMaterial;
- newExecutablePlan.ResultTypeID = newSpecialtyPlanView.ResultTypeID;
- newExecutablePlan.HandleModeID = newSpecialtyPlanView.HandleModeID;
- SetModifyStatus(newExecutablePlan);
- newExecutablePlanUpList.Add(newExecutablePlan);
- if (newExecutablePlan.EM_ExecutablePlanProfile == null)
- {
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = newSpecialtyPlanView.IsSpecialtycore;
- newProfile.IsCooperation = newSpecialtyPlanView.IsCooperation;
- newProfile.IsRequired = newSpecialtyPlanView.IsRequired;
- newProfile.IsElective = newSpecialtyPlanView.IsElective;
- newProfile.IsNetworkCourse = newSpecialtyPlanView.IsNetworkCourse;
- newProfile.IsMainCourse = newSpecialtyPlanView.IsMainCourse;
- newProfile.CourseFineID = newSpecialtyPlanView.CourseFineID;
- newProfile.PracticeTypeID = newSpecialtyPlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = newSpecialtyPlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = newSpecialtyPlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- }
- else
- {
- newExecutablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = newSpecialtyPlanView.IsSpecialtycore;
- newExecutablePlan.EM_ExecutablePlanProfile.IsCooperation = newSpecialtyPlanView.IsCooperation;
- newExecutablePlan.EM_ExecutablePlanProfile.IsRequired = newSpecialtyPlanView.IsRequired;
- newExecutablePlan.EM_ExecutablePlanProfile.IsElective = newSpecialtyPlanView.IsElective;
- newExecutablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = newSpecialtyPlanView.IsNetworkCourse;
- newExecutablePlan.EM_ExecutablePlanProfile.IsMainCourse = newSpecialtyPlanView.IsMainCourse;
- newExecutablePlan.EM_ExecutablePlanProfile.CourseFineID = newSpecialtyPlanView.CourseFineID;
- newExecutablePlan.EM_ExecutablePlanProfile.PracticeTypeID = newSpecialtyPlanView.PracticeTypeID;
- newExecutablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = newSpecialtyPlanView.TeachinglanguageID;
- newExecutablePlan.EM_ExecutablePlanProfile.ExaminationModeID = newSpecialtyPlanView.ExaminationModeID;
- SetModifyStatus(newExecutablePlan.EM_ExecutablePlanProfile);
- newProfileUpList.Add(newExecutablePlan.EM_ExecutablePlanProfile);
- }
- if (newExecutablePlan.EM_ExecutablePlanTeachingSetting == null)
- {
- var newEPTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newEPTeachingSetting.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newEPTeachingSetting.Credit = newSpecialtyPlanView.Credit;
- newEPTeachingSetting.TheoryCourse = newSpecialtyPlanView.TheoryCourse;
- newEPTeachingSetting.Practicehours = newSpecialtyPlanView.Practicehours;
- newEPTeachingSetting.Trialhours = newSpecialtyPlanView.Trialhours;
- newEPTeachingSetting.TheoryWeeklyNum = newSpecialtyPlanView.TheoryWeeklyNum;
- newEPTeachingSetting.PracticeWeeklyNum = newSpecialtyPlanView.PracticeWeeklyNum;
- newEPTeachingSetting.TrialWeeklyNum = newSpecialtyPlanView.TrialWeeklyNum;
- newEPTeachingSetting.WeeklyHours = newSpecialtyPlanView.WeeklyHours;
- newEPTeachingSetting.WeeklyNum = newSpecialtyPlanView.WeeklyNum;
- newEPTeachingSetting.StartWeeklyNum = newSpecialtyPlanView.StartWeeklyNum;
- newEPTeachingSetting.EndWeeklyNum = newSpecialtyPlanView.EndWeeklyNum;
- newEPTeachingSettingInList.Add(newEPTeachingSetting);
- }
- else
- {
- //可更新的相关信息
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.Credit = newSpecialtyPlanView.Credit;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = newSpecialtyPlanView.TheoryCourse;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = newSpecialtyPlanView.Practicehours;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = newSpecialtyPlanView.Trialhours;
- if (newExecutablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = newSpecialtyPlanView.TheoryWeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = newSpecialtyPlanView.PracticeWeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = newSpecialtyPlanView.TrialWeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = newSpecialtyPlanView.WeeklyHours;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = newSpecialtyPlanView.WeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = newSpecialtyPlanView.StartWeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = newSpecialtyPlanView.EndWeeklyNum;
- }
- newEPTeachingSettingUpList.Add(newExecutablePlan.EM_ExecutablePlanTeachingSetting);
- }
- if (newExecutablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- //可更新的相关信息
- if (newSpecialtyPlanView.TeachingModeIDList != null && newSpecialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- executablePlanTMDelList.Add(newExecutablePlan.ExecutablePlanID);
- foreach (var newModeType in newSpecialtyPlanView.TeachingModeIDList.ToList())
- {
- var newEPTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newEPTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newEPTeachingModeType.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newEPTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newEPTeachingModeType);
- newEPTeachingModeTypeInList.Add(newEPTeachingModeType);
- }
- }
- else
- {
- executablePlanTMDelList.Add(newExecutablePlan.ExecutablePlanID);
- }
- }
- if (newSpecialtyPlanView.TeachingPlaceIDList != null && newSpecialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- executablePlanTPDelList.Add(newExecutablePlan.ExecutablePlanID);
- foreach (var newPlace in newSpecialtyPlanView.TeachingPlaceIDList.ToList())
- {
- var newEPTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newEPTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newEPTeachingPlace.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newEPTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newEPTeachingPlace);
- newEPTeachingPlaceInList.Add(newEPTeachingPlace);
- }
- }
- else
- {
- executablePlanTPDelList.Add(newExecutablePlan.ExecutablePlanID);
- }
- }
- executablePlanIDList.Add(newExecutablePlan.ExecutablePlanID);
- }
- }
- }
- }
- }
- else
- {
- //表示新增
- var newSpecialtyPlan = new EM_SpecialtyPlan();
- newSpecialtyPlan.SpecialtyPlanID = Guid.NewGuid();
- newSpecialtyPlan.PlanApplicationID = null;
- newSpecialtyPlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- newSpecialtyPlan.GrademajorID = specialtyPlanView.GrademajorID;
- newSpecialtyPlan.CoursematerialID = specialtyPlanView.CoursematerialID;
- newSpecialtyPlan.CourseStructureID = specialtyPlanView.CourseStructureID;
- newSpecialtyPlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
- newSpecialtyPlan.CourseTypeID = specialtyPlanView.CourseTypeID;
- newSpecialtyPlan.CourseQualityID = specialtyPlanView.CourseQualityID;
- newSpecialtyPlan.DepartmentID = specialtyPlanView.DepartmentID;
- newSpecialtyPlan.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- newSpecialtyPlan.IsCooperation = specialtyPlanView.IsCooperation;
- newSpecialtyPlan.IsRequired = specialtyPlanView.IsRequired;
- newSpecialtyPlan.IsElective = specialtyPlanView.IsElective;
- newSpecialtyPlan.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- newSpecialtyPlan.IsMainCourse = specialtyPlanView.IsMainCourse;
- newSpecialtyPlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
- newSpecialtyPlan.CourseFineID = specialtyPlanView.CourseFineID;
- newSpecialtyPlan.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- newSpecialtyPlan.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- newSpecialtyPlan.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- newSpecialtyPlan.ResultTypeID = specialtyPlanView.ResultTypeID;
- newSpecialtyPlan.HandleModeID = specialtyPlanView.HandleModeID;
- newSpecialtyPlan.Remark = specialtyPlanView.Remark;
- SetNewStatus(newSpecialtyPlan);
- newSpecialtyPlanInList.Add(newSpecialtyPlan);
- var newSPTeachingSetting = new EM_SpecialtyPlanTeachingSetting();
- newSPTeachingSetting.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- newSPTeachingSetting.Credit = specialtyPlanView.Credit;
- newSPTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- newSPTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- newSPTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- newSPTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- newSPTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- newSPTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- newSPTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- newSPTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- newSPTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- newSPTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- newSPTeachingSettingInList.Add(newSPTeachingSetting);
- if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- foreach (var teachingModeID in specialtyPlanView.TeachingModeIDList)
- {
- var newSPTeachingMode = new EM_SpecialtyPlanTeachingModeType();
- newSPTeachingMode.SpecialtyPlanTeachingModeTypeID = Guid.NewGuid();
- newSPTeachingMode.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- newSPTeachingMode.TeachingModeID = teachingModeID;
- SetNewStatus(newSPTeachingMode);
- newSPTeachingModeTypeInList.Add(newSPTeachingMode);
- }
- }
- if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- foreach (var teachingPlaceID in specialtyPlanView.TeachingPlaceIDList)
- {
- var newSPTeachingPlace = new EM_SpecialtyPlanTeachingPlace();
- newSPTeachingPlace.SpecialtyPlanTeachingPlaceID = Guid.NewGuid();
- newSPTeachingPlace.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- newSPTeachingPlace.TeachingPlace = teachingPlaceID;
- SetNewStatus(newSPTeachingPlace);
- newSPTeachingPlaceInList.Add(newSPTeachingPlace);
- }
- }
- //对应的执行计划信息更新(根据业务主键:学年学期ID、年级专业ID、课程信息ID)
- //注:由于相关业务主键冗余且同时存在主外键关联,目前不允许修改相关业务主键
- var executablePlan = SpecialtyPlanDAL.ExecutablePlanRepository.GetList(x => x.SchoolyearID == specialtyPlanView.SchoolyearID
- && x.GrademajorID == specialtyPlanView.GrademajorID
- && x.CoursematerialID == specialtyPlanView.CoursematerialID,
- (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).SingleOrDefault();
- if (executablePlan == null)
- {
- //表示不存在对应的执行计划信息(暂不新增)
- }
- else
- {
- //表示存在对应的执行计划信息(修改)
- executablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
- //暂不考虑
- //executablePlan.DefaultClassName = specialtyPlanView.CourseName + "-" + specialtyPlanView.GrademajorName;
- executablePlan.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- executablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- executablePlan.GrademajorID = specialtyPlanView.GrademajorID;
- executablePlan.CoursematerialID = specialtyPlanView.CoursematerialID;
- executablePlan.CourseStructureID = specialtyPlanView.CourseStructureID;
- executablePlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
- executablePlan.CourseTypeID = specialtyPlanView.CourseTypeID;
- executablePlan.CourseQualityID = specialtyPlanView.CourseQualityID;
- executablePlan.DepartmentID = specialtyPlanView.DepartmentID;
- executablePlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
- executablePlan.ResultTypeID = specialtyPlanView.ResultTypeID;
- executablePlan.HandleModeID = specialtyPlanView.HandleModeID;
- SetModifyStatus(executablePlan);
- newExecutablePlanUpList.Add(executablePlan);
- if (executablePlan.EM_ExecutablePlanProfile == null)
- {
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- newProfile.IsCooperation = specialtyPlanView.IsCooperation;
- newProfile.IsRequired = specialtyPlanView.IsRequired;
- newProfile.IsElective = specialtyPlanView.IsElective;
- newProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- newProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
- newProfile.CourseFineID = specialtyPlanView.CourseFineID;
- newProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- }
- else
- {
- executablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- executablePlan.EM_ExecutablePlanProfile.IsCooperation = specialtyPlanView.IsCooperation;
- executablePlan.EM_ExecutablePlanProfile.IsRequired = specialtyPlanView.IsRequired;
- executablePlan.EM_ExecutablePlanProfile.IsElective = specialtyPlanView.IsElective;
- executablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- executablePlan.EM_ExecutablePlanProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
- executablePlan.EM_ExecutablePlanProfile.CourseFineID = specialtyPlanView.CourseFineID;
- executablePlan.EM_ExecutablePlanProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- executablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- executablePlan.EM_ExecutablePlanProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- SetModifyStatus(executablePlan.EM_ExecutablePlanProfile);
- newProfileUpList.Add(executablePlan.EM_ExecutablePlanProfile);
- }
- if (executablePlan.EM_ExecutablePlanTeachingSetting == null)
- {
- var newEPTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newEPTeachingSetting.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingSetting.Credit = specialtyPlanView.Credit;
- newEPTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- newEPTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- newEPTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- newEPTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- newEPTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- newEPTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- newEPTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- newEPTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- newEPTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- newEPTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- newEPTeachingSettingInList.Add(newEPTeachingSetting);
- }
- else
- {
- //可更新的相关信息
- executablePlan.EM_ExecutablePlanTeachingSetting.Credit = specialtyPlanView.Credit;
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- executablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- executablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- }
- newEPTeachingSettingUpList.Add(executablePlan.EM_ExecutablePlanTeachingSetting);
- }
- if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- //可更新的相关信息
- if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newModeType in specialtyPlanView.TeachingModeIDList.ToList())
- {
- var newEPTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newEPTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newEPTeachingModeType.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newEPTeachingModeType);
- newEPTeachingModeTypeInList.Add(newEPTeachingModeType);
- }
- }
- else
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- }
- }
- if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newPlace in specialtyPlanView.TeachingPlaceIDList.ToList())
- {
- var newEPTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newEPTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newEPTeachingPlace.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newEPTeachingPlace);
- newEPTeachingPlaceInList.Add(newEPTeachingPlace);
- }
- }
- else
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- }
- executablePlanIDList.Add(executablePlan.ExecutablePlanID);
- }
- }
- //事务提交
- //UnitOfWork.Commit();
- using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew, new TransactionOptions { IsolationLevel = IsolationLevel.Serializable }))
- {
- //删除
- UnitOfWork.Delete<EM_SpecialtyPlanTeachingPlace>(x => specialtyPlanTPDelList.Contains(x.SpecialtyPlanID));
- UnitOfWork.Delete<EM_SpecialtyPlanTeachingModeType>(x => specialtyPlanTMDelList.Contains(x.SpecialtyPlanID));
- //批量插入
- UnitOfWork.BulkInsert(newSpecialtyPlanInList);
- UnitOfWork.BulkInsert(newSPTeachingSettingInList);
- UnitOfWork.BulkInsert(newSPTeachingModeTypeInList);
- UnitOfWork.BulkInsert(newSPTeachingPlaceInList);
- //批量统一提交更新
- if (newSpecialtyPlanUpList != null && newSpecialtyPlanUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newSpecialtyPlanUpList);
- }
- //批量统一提交更新
- if (newSPTeachingSettingUpList != null && newSPTeachingSettingUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newSPTeachingSettingUpList);
- }
- //删除
- UnitOfWork.Delete<EM_ExecutablePlanTeachingPlace>(x => executablePlanTPDelList.Contains(x.ExecutablePlanID));
- UnitOfWork.Delete<EM_ExecutablePlanTeachingModeType>(x => executablePlanTMDelList.Contains(x.ExecutablePlanID));
- //批量插入
- UnitOfWork.BulkInsert(newProfileInList);
- UnitOfWork.BulkInsert(newEPTeachingSettingInList);
- UnitOfWork.BulkInsert(newEPTeachingModeTypeInList);
- UnitOfWork.BulkInsert(newEPTeachingPlaceInList);
- //批量统一提交更新
- if (newExecutablePlanUpList != null && newExecutablePlanUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newExecutablePlanUpList);
- }
- //批量统一提交更新
- if (newProfileUpList != null && newProfileUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newProfileUpList);
- }
- //批量统一提交更新
- if (newEPTeachingSettingUpList != null && newEPTeachingSettingUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEPTeachingSettingUpList);
- }
- ts.Complete();
- }
- }
- else
- {
- throw new Exception("已存在相同的专业计划信息(学年学期、年级专业、课程信息唯一),请核查。");
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 专业课程模版批量新增
- /// </summary>
- /// <param name="specialtyCourseViewList"></param>
- /// <param name="specialtyPlanView"></param>
- /// <returns></returns>
- public string SpecialtyPlanBatchAdd(List<SpecialtyCourseView> specialtyCourseViewList, SpecialtyPlanView specialtyPlanView)
- {
- try
- {
- //查询对应的年级专业信息
- var grademajor = SpecialtyPlanDAL.GrademajorRepository.GetList(x => x.GrademajorID == specialtyPlanView.GrademajorID).SingleOrDefault();
- if (grademajor == null)
- {
- throw new Exception("选择新增的年级专业不存在,请检查。");
- }
- //查询学年学期信息schoolyearList
- var schoolyearList = SpecialtyPlanDAL.SchoolyearRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
- //查询年级专业对应的入学学年学期信息
- var startSchoolyear = schoolyearList.Where(x => x.Years == grademajor.GradeID && x.SchoolcodeID == grademajor.SemesterID).SingleOrDefault();
- if (startSchoolyear == null)
- {
- throw new Exception("选择新增的年级专业对应的入学学年学期不存在,请检查。");
- }
- //查询年级专业对应的毕业学年学期信息
- var graduatingSemester = schoolyearList.Where(x => x.SchoolyearID == grademajor.GraduateSchoolyearID).SingleOrDefault();
- if (graduatingSemester == null)
- {
- throw new Exception("选择新增的年级专业对应的毕业学年学期信息不存在,请检查。");
- }
- //查询专业计划信息specialtyPlanList
- var specialtyPlanList = SpecialtyPlanDAL.SpecialtyPlanRepository.GetList(x => x.GrademajorID == grademajor.GrademajorID, (x => x.EM_SpecialtyPlanTeachingSetting)).ToList();
- int success = 0; //成功
- int fail = 0; //失败
- string tipMessage = null; //提示消息
- List<EM_SpecialtyPlan> newSpecialtyPlanInList = new List<EM_SpecialtyPlan>();
- List<EM_SpecialtyPlanTeachingSetting> newTeachingSettingInList = new List<EM_SpecialtyPlanTeachingSetting>();
- List<EM_SpecialtyPlanTeachingModeType> newTeachingModeTypeInList = new List<EM_SpecialtyPlanTeachingModeType>();
- List<EM_SpecialtyPlanTeachingPlace> newTeachingPlaceInList = new List<EM_SpecialtyPlanTeachingPlace>();
- foreach (var specialtyCourseView in specialtyCourseViewList)
- {
- //判断对应的学年学期信息
- var value = startSchoolyear.Value + specialtyCourseView.StarttermID - 1;
- if (value < startSchoolyear.Value)
- {
- //表示学年学期小于入学学年学期
- fail++;
- }
- else
- {
- if (value > graduatingSemester.Value)
- {
- //表示学年学期大于毕业学年学期
- fail++;
- }
- else
- {
- var schoolyear = schoolyearList.Where(x => x.Value == value).SingleOrDefault();
- if (schoolyear == null)
- {
- //表示对应的学年学期信息不存在
- fail++;
- }
- else
- {
- //查询对应的专业计划信息(根据业务主键:学年学期ID、年级专业ID、课程信息ID)
- var specialtyPlan = specialtyPlanList.Where(x => x.SchoolyearID == schoolyear.SchoolyearID
- && x.GrademajorID == grademajor.GrademajorID
- && x.CoursematerialID == specialtyCourseView.CoursematerialID).SingleOrDefault();
- if (specialtyPlan == null)
- {
- //表示新增
- var newSpecialtyPlan = new EM_SpecialtyPlan();
- newSpecialtyPlan.SpecialtyPlanID = Guid.NewGuid();
- newSpecialtyPlan.PlanApplicationID = null;
- newSpecialtyPlan.SchoolyearID = schoolyear.SchoolyearID;
- newSpecialtyPlan.GrademajorID = grademajor.GrademajorID;
- newSpecialtyPlan.CoursematerialID = specialtyCourseView.CoursematerialID;
- newSpecialtyPlan.CourseStructureID = specialtyCourseView.CourseStructureID;
- newSpecialtyPlan.CourseCategoryID = specialtyCourseView.CourseCategoryID;
- newSpecialtyPlan.CourseTypeID = specialtyCourseView.CourseTypeID;
- newSpecialtyPlan.CourseQualityID = specialtyCourseView.CourseQualityID;
- newSpecialtyPlan.DepartmentID = specialtyCourseView.DepartmentID;
- newSpecialtyPlan.IsSpecialtycore = specialtyCourseView.IsSpecialtycore;
- newSpecialtyPlan.IsCooperation = specialtyCourseView.IsCooperation;
- newSpecialtyPlan.IsRequired = specialtyCourseView.IsRequired;
- newSpecialtyPlan.IsElective = specialtyCourseView.IsElective;
- newSpecialtyPlan.IsNetworkCourse = specialtyCourseView.IsNetworkCourse;
- newSpecialtyPlan.IsMainCourse = specialtyCourseView.IsMainCourse;
- newSpecialtyPlan.IsNeedMaterial = specialtyCourseView.IsNeedMaterial;
- newSpecialtyPlan.CourseFineID = specialtyCourseView.CourseFineID;
- newSpecialtyPlan.PracticeTypeID = specialtyCourseView.PracticeTypeID;
- newSpecialtyPlan.TeachinglanguageID = specialtyCourseView.TeachinglanguageID;
- newSpecialtyPlan.ExaminationModeID = specialtyCourseView.ExaminationModeID;
- newSpecialtyPlan.ResultTypeID = specialtyCourseView.ResultTypeID;
- newSpecialtyPlan.HandleModeID = specialtyCourseView.HandleModeID;
- newSpecialtyPlan.Remark = specialtyPlanView.Remark;
- SetNewStatus(newSpecialtyPlan);
- newSpecialtyPlanInList.Add(newSpecialtyPlan);
- var newTeachingSetting = new EM_SpecialtyPlanTeachingSetting();
- newTeachingSetting.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- newTeachingSetting.Credit = specialtyCourseView.Credit;
- newTeachingSetting.TheoryCourse = specialtyCourseView.TheoryCourse;
- newTeachingSetting.Practicehours = specialtyCourseView.Practicehours;
- newTeachingSetting.Trialhours = specialtyCourseView.Trialhours;
- newTeachingSetting.TheoryWeeklyNum = specialtyCourseView.TheoryWeeklyNum;
- newTeachingSetting.PracticeWeeklyNum = specialtyCourseView.PracticeWeeklyNum;
- newTeachingSetting.TrialWeeklyNum = specialtyCourseView.TrialWeeklyNum;
- newTeachingSetting.WeeklyHours = specialtyCourseView.WeeklyHours;
- newTeachingSetting.WeeklyNum = specialtyCourseView.WeeklyNum;
- newTeachingSetting.StartWeeklyNum = specialtyCourseView.StartWeeklyNum;
- newTeachingSetting.EndWeeklyNum = specialtyCourseView.EndWeeklyNum;
- newTeachingSettingInList.Add(newTeachingSetting);
- if (specialtyCourseView.TeachingModeIDList != null && specialtyCourseView.TeachingModeIDList.Count() > 0)
- {
- foreach (var teachingModeID in specialtyCourseView.TeachingModeIDList)
- {
- var newTeachingMode = new EM_SpecialtyPlanTeachingModeType();
- newTeachingMode.SpecialtyPlanTeachingModeTypeID = Guid.NewGuid();
- newTeachingMode.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- newTeachingMode.TeachingModeID = teachingModeID;
- SetNewStatus(newTeachingMode);
- newTeachingModeTypeInList.Add(newTeachingMode);
- }
- }
- if (specialtyCourseView.TeachingPlaceIDList != null && specialtyCourseView.TeachingPlaceIDList.Count() > 0)
- {
- foreach (var teachingPlaceID in specialtyCourseView.TeachingPlaceIDList)
- {
- var newTeachingPlace = new EM_SpecialtyPlanTeachingPlace();
- newTeachingPlace.SpecialtyPlanTeachingPlaceID = Guid.NewGuid();
- newTeachingPlace.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- newTeachingPlace.TeachingPlace = teachingPlaceID;
- SetNewStatus(newTeachingPlace);
- newTeachingPlaceInList.Add(newTeachingPlace);
- }
- }
- success++;
- }
- else
- {
- //表示已存在相同的计划申请信息
- fail++;
- }
- }
- }
- }
- }
- //事务提交
- using (TransactionScope ts = new TransactionScope())
- {
- //批量插入
- UnitOfWork.BulkInsert(newSpecialtyPlanInList);
- 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>
- /// 查询对应的未新增专业课程信息SpecialtyCourseView
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="departmentID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="starttermID"></param>
- /// <param name="handleModeID"></param>
- /// <param name="yearID"></param>
- /// <param name="grademajorID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<SpecialtyCourseView> GetSpecialtyCourseViewNoAddGrid(ConfiguretView configuretView, Guid? departmentID,
- int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? coursematerialID, int? starttermID,
- int? handleModeID, int? yearID, Guid? grademajorID, int pageIndex, int pageSize)
- {
- //专业课程
- Expression<Func<EM_SpecialtyCourse, bool>> expSpecialtyCourse = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyCourse = expSpecialtyCourse.And(x => x.IsEnable == true);
- if (departmentID.HasValue)
- {
- expSpecialtyCourse = expSpecialtyCourse.And(x => x.DepartmentID == departmentID);
- }
- if (coursematerialID.HasValue)
- {
- expSpecialtyCourse = expSpecialtyCourse.And(x => x.CoursematerialID == coursematerialID);
- }
- if (starttermID.HasValue)
- {
- expSpecialtyCourse = expSpecialtyCourse.And(x => x.StarttermID == starttermID);
- }
- if (handleModeID.HasValue)
- {
- expSpecialtyCourse = expSpecialtyCourse.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);
- }
- expGrademajor = expGrademajor.And(x => x.GrademajorID == grademajorID);
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (coursematerialID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
- }
- if (grademajorID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.GrademajorID == grademajorID);
- }
- var query = SpecialtyPlanDAL.GetSpecialtyCourseViewNoAddQueryable(expSpecialtyCourse, expGrademajor, expSpecialtyPlan);
- 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 (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.StandardID).ThenBy(x => x.EducationID)
- .ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem)
- .ThenBy(x => x.StarttermID).ThenBy(x => x.CourseTypeID)
- .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
- .ToGridResultSet<SpecialtyCourseView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询对应的未新增专业课程信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="departmentID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="starttermID"></param>
- /// <param name="handleModeID"></param>
- /// <param name="yearID"></param>
- /// <param name="grademajorID"></param>
- /// <returns></returns>
- public IList<SpecialtyCourseView> GetSpecialtyCourseViewNoAddList(ConfiguretView configuretView, Guid? departmentID,
- int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? coursematerialID, int? starttermID,
- int? handleModeID, int? yearID, Guid? grademajorID)
- {
- //专业课程
- Expression<Func<EM_SpecialtyCourse, bool>> expSpecialtyCourse = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyCourse = expSpecialtyCourse.And(x => x.IsEnable == true);
- if (departmentID.HasValue)
- {
- expSpecialtyCourse = expSpecialtyCourse.And(x => x.DepartmentID == departmentID);
- }
- if (coursematerialID.HasValue)
- {
- expSpecialtyCourse = expSpecialtyCourse.And(x => x.CoursematerialID == coursematerialID);
- }
- if (starttermID.HasValue)
- {
- expSpecialtyCourse = expSpecialtyCourse.And(x => x.StarttermID == starttermID);
- }
- if (handleModeID.HasValue)
- {
- expSpecialtyCourse = expSpecialtyCourse.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);
- }
- expGrademajor = expGrademajor.And(x => x.GrademajorID == grademajorID);
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (coursematerialID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
- }
- if (grademajorID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.GrademajorID == grademajorID);
- }
- var query = SpecialtyPlanDAL.GetSpecialtyCourseViewNoAddQueryable(expSpecialtyCourse, expGrademajor, expSpecialtyPlan);
- 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 (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.StandardID).ThenBy(x => x.EducationID)
- .ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem)
- .ThenBy(x => x.StarttermID).ThenBy(x => x.CourseTypeID)
- .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode).ToList();
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="specialtyPlanIDs"></param>
- /// <returns></returns>
- public bool SpecialtyPlanDelete(List<Guid?> specialtyPlanIDs)
- {
- try
- {
- //查询对应的专业计划信息List
- var specialtyPlanList = SpecialtyPlanDAL.SpecialtyPlanRepository.GetList(x => specialtyPlanIDs.Contains(x.SpecialtyPlanID)).ToList();
- //查询对应的计划申请IDList
- var planApplicationIDList = specialtyPlanList.Select(x => x.PlanApplicationID).ToList();
- using (TransactionScope ts = new TransactionScope())
- {
- UnitOfWork.Delete<EM_SpecialtyPlanTeachingPlace>(x => specialtyPlanIDs.Contains(x.SpecialtyPlanID));
- UnitOfWork.Delete<EM_SpecialtyPlanTeachingModeType>(x => specialtyPlanIDs.Contains(x.SpecialtyPlanID));
- UnitOfWork.Delete<EM_SpecialtyPlanTeachingSetting>(x => specialtyPlanIDs.Contains(x.SpecialtyPlanID));
- UnitOfWork.Delete<EM_SpecialtyPlan>(x => specialtyPlanIDs.Contains(x.SpecialtyPlanID));
- //同时删除对应的计划申请信息
- UnitOfWork.Delete<EM_PlanApplicationTeachingPlace>(x => planApplicationIDList.Contains(x.PlanApplicationID));
- UnitOfWork.Delete<EM_PlanApplicationTeachingModeType>(x => planApplicationIDList.Contains(x.PlanApplicationID));
- UnitOfWork.Delete<EM_PlanApplicationTeachingSetting>(x => planApplicationIDList.Contains(x.PlanApplicationID));
- UnitOfWork.Delete<EM_PlanApplication>(x => planApplicationIDList.Contains(x.PlanApplicationID));
- ts.Complete();
- return true;
- }
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 专业计划执行
- /// 注:普教版本(年级专业)
- /// </summary>
- /// <param name="specialtyPlanIDList"></param>
- /// <returns></returns>
- public string SpecialtyPlanExecute(List<Guid?> specialtyPlanIDList)
- {
- try
- {
- //查询对应的专业计划信息specialtyPlanViewList
- var specialtyPlanViewList = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(x => specialtyPlanIDList.Contains(x.SpecialtyPlanID)).ToList();
- //查询对应的年级专业IDList
- var grademajorIDList = specialtyPlanViewList.Select(x => x.GrademajorID).ToList();
- //查询对比后的执行计划信息List(暂时只对比年级专业ID)
- var executablePlanList = SpecialtyPlanDAL.ExecutablePlanRepository
- .GetList(x => grademajorIDList.Contains(x.GrademajorID), (x => x.EM_ExecutablePlanProfile),
- (x => x.EM_ExecutablePlanTeachingSetting)).ToList();
- int insert = 0; //成功
- int update = 0; //更新
- int fail = 0; //失败
- string tipMessage = null; //提示消息
- 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> newTeachingSettingInList = new List<EM_ExecutablePlanTeachingSetting>();
- List<EM_ExecutablePlanTeachingSetting> newTeachingSettingUpList = new List<EM_ExecutablePlanTeachingSetting>();
- List<EM_ExecutablePlanTeachingModeType> newTeachingModeTypeInList = new List<EM_ExecutablePlanTeachingModeType>();
- List<EM_ExecutablePlanTeachingPlace> newTeachingPlaceInList = new List<EM_ExecutablePlanTeachingPlace>();
- List<Guid?> executablePlanTMDelList = new List<Guid?>();
- List<Guid?> executablePlanTPDelList = new List<Guid?>();
- List<Guid> executablePlanIDList = new List<Guid>();
- 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);
- }
- }
- insert++;
- }
- else
- {
- if (!executablePlanIDList.Contains(executablePlan.ExecutablePlanID))
- {
- //表示存在对应的执行计划信息(修改)
- executablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
- executablePlan.DefaultClassName = specialtyPlanView.CourseName + "-" + specialtyPlanView.GrademajorName;
- executablePlan.SpecialtyPlanID = specialtyPlanView.SpecialtyPlanID;
- executablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- executablePlan.GrademajorID = specialtyPlanView.GrademajorID;
- executablePlan.CoursematerialID = specialtyPlanView.CoursematerialID;
- executablePlan.CourseStructureID = specialtyPlanView.CourseStructureID;
- executablePlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
- executablePlan.CourseTypeID = specialtyPlanView.CourseTypeID;
- executablePlan.CourseQualityID = specialtyPlanView.CourseQualityID;
- executablePlan.DepartmentID = specialtyPlanView.DepartmentID;
- executablePlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
- executablePlan.ResultTypeID = specialtyPlanView.ResultTypeID;
- executablePlan.HandleModeID = specialtyPlanView.HandleModeID;
- SetModifyStatus(executablePlan);
- newExecutablePlanUpList.Add(executablePlan);
- if (executablePlan.EM_ExecutablePlanProfile == null)
- {
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- newProfile.IsCooperation = specialtyPlanView.IsCooperation;
- newProfile.IsRequired = specialtyPlanView.IsRequired;
- newProfile.IsElective = specialtyPlanView.IsElective;
- newProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- newProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
- newProfile.CourseFineID = specialtyPlanView.CourseFineID;
- newProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- }
- else
- {
- executablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- executablePlan.EM_ExecutablePlanProfile.IsCooperation = specialtyPlanView.IsCooperation;
- executablePlan.EM_ExecutablePlanProfile.IsRequired = specialtyPlanView.IsRequired;
- executablePlan.EM_ExecutablePlanProfile.IsElective = specialtyPlanView.IsElective;
- executablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- executablePlan.EM_ExecutablePlanProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
- executablePlan.EM_ExecutablePlanProfile.CourseFineID = specialtyPlanView.CourseFineID;
- executablePlan.EM_ExecutablePlanProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- executablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- executablePlan.EM_ExecutablePlanProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- SetModifyStatus(executablePlan.EM_ExecutablePlanProfile);
- newProfileUpList.Add(executablePlan.EM_ExecutablePlanProfile);
- }
- if (executablePlan.EM_ExecutablePlanTeachingSetting == null)
- {
- var newTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newTeachingSetting.ExecutablePlanID = executablePlan.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);
- }
- else
- {
- //可更新的相关信息
- executablePlan.EM_ExecutablePlanTeachingSetting.Credit = specialtyPlanView.Credit;
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- executablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- executablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- }
- newTeachingSettingUpList.Add(executablePlan.EM_ExecutablePlanTeachingSetting);
- }
- if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- //可更新的相关信息
- if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newModeType in specialtyPlanView.TeachingModeIDList.ToList())
- {
- var newTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newTeachingModeType.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newTeachingModeType);
- newTeachingModeTypeInList.Add(newTeachingModeType);
- }
- }
- else
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- }
- }
- if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newPlace in specialtyPlanView.TeachingPlaceIDList.ToList())
- {
- var newTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newTeachingPlace.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newTeachingPlace);
- newTeachingPlaceInList.Add(newTeachingPlace);
- }
- }
- else
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- }
- executablePlanIDList.Add(executablePlan.ExecutablePlanID);
- }
- update++;
- }
- //表示存在对应的主外键关联
- if (specialtyPlanView.PlanStatus == (int)EM_PlanStatus.Execute)
- {
- //根据专业计划主键ID查询对应的执行计划信息List
- var newExecutablePlanList = SpecialtyPlanDAL.ExecutablePlanRepository
- .GetList(x => x.SpecialtyPlanID == specialtyPlanView.SpecialtyPlanID,
- (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).ToList();
- foreach (var newExecutablePlan in newExecutablePlanList)
- {
- if (!executablePlanIDList.Contains(newExecutablePlan.ExecutablePlanID))
- {
- //查询对应的专业计划信息(业务主键:学年学期ID、年级专业ID、课程信息ID)
- var newSpecialtyPlanView = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(x => x.SpecialtyPlanID != specialtyPlanView.SpecialtyPlanID
- && x.SchoolyearID == newExecutablePlan.SchoolyearID
- && x.GrademajorID == newExecutablePlan.GrademajorID
- && x.CoursematerialID == newExecutablePlan.CoursematerialID).SingleOrDefault();
- if (newSpecialtyPlanView == null)
- {
- newExecutablePlan.SpecialtyPlanID = null;
- SetModifyStatus(newExecutablePlan);
- newExecutablePlanUpList.Add(newExecutablePlan);
- }
- else
- {
- //来源专业计划默认为必修课
- newExecutablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
- newExecutablePlan.DefaultClassName = newSpecialtyPlanView.CourseName + "-" + newSpecialtyPlanView.GrademajorName;
- newExecutablePlan.SpecialtyPlanID = newSpecialtyPlanView.SpecialtyPlanID;
- newExecutablePlan.SchoolyearID = newSpecialtyPlanView.SchoolyearID;
- newExecutablePlan.GrademajorID = newSpecialtyPlanView.GrademajorID;
- newExecutablePlan.CoursematerialID = newSpecialtyPlanView.CoursematerialID;
- newExecutablePlan.CourseStructureID = newSpecialtyPlanView.CourseStructureID;
- newExecutablePlan.CourseCategoryID = newSpecialtyPlanView.CourseCategoryID;
- newExecutablePlan.CourseTypeID = newSpecialtyPlanView.CourseTypeID;
- newExecutablePlan.CourseQualityID = newSpecialtyPlanView.CourseQualityID;
- newExecutablePlan.DepartmentID = newSpecialtyPlanView.DepartmentID;
- newExecutablePlan.IsNeedMaterial = newSpecialtyPlanView.IsNeedMaterial;
- newExecutablePlan.ResultTypeID = newSpecialtyPlanView.ResultTypeID;
- newExecutablePlan.HandleModeID = newSpecialtyPlanView.HandleModeID;
- SetModifyStatus(newExecutablePlan);
- newExecutablePlanUpList.Add(newExecutablePlan);
- if (newExecutablePlan.EM_ExecutablePlanProfile == null)
- {
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = newSpecialtyPlanView.IsSpecialtycore;
- newProfile.IsCooperation = newSpecialtyPlanView.IsCooperation;
- newProfile.IsRequired = newSpecialtyPlanView.IsRequired;
- newProfile.IsElective = newSpecialtyPlanView.IsElective;
- newProfile.IsNetworkCourse = newSpecialtyPlanView.IsNetworkCourse;
- newProfile.IsMainCourse = newSpecialtyPlanView.IsMainCourse;
- newProfile.CourseFineID = newSpecialtyPlanView.CourseFineID;
- newProfile.PracticeTypeID = newSpecialtyPlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = newSpecialtyPlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = newSpecialtyPlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- }
- else
- {
- newExecutablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = newSpecialtyPlanView.IsSpecialtycore;
- newExecutablePlan.EM_ExecutablePlanProfile.IsCooperation = newSpecialtyPlanView.IsCooperation;
- newExecutablePlan.EM_ExecutablePlanProfile.IsRequired = newSpecialtyPlanView.IsRequired;
- newExecutablePlan.EM_ExecutablePlanProfile.IsElective = newSpecialtyPlanView.IsElective;
- newExecutablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = newSpecialtyPlanView.IsNetworkCourse;
- newExecutablePlan.EM_ExecutablePlanProfile.IsMainCourse = newSpecialtyPlanView.IsMainCourse;
- newExecutablePlan.EM_ExecutablePlanProfile.CourseFineID = newSpecialtyPlanView.CourseFineID;
- newExecutablePlan.EM_ExecutablePlanProfile.PracticeTypeID = newSpecialtyPlanView.PracticeTypeID;
- newExecutablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = newSpecialtyPlanView.TeachinglanguageID;
- newExecutablePlan.EM_ExecutablePlanProfile.ExaminationModeID = newSpecialtyPlanView.ExaminationModeID;
- SetModifyStatus(newExecutablePlan.EM_ExecutablePlanProfile);
- newProfileUpList.Add(newExecutablePlan.EM_ExecutablePlanProfile);
- }
- if (newExecutablePlan.EM_ExecutablePlanTeachingSetting == null)
- {
- var newTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newTeachingSetting.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newTeachingSetting.Credit = newSpecialtyPlanView.Credit;
- newTeachingSetting.TheoryCourse = newSpecialtyPlanView.TheoryCourse;
- newTeachingSetting.Practicehours = newSpecialtyPlanView.Practicehours;
- newTeachingSetting.Trialhours = newSpecialtyPlanView.Trialhours;
- newTeachingSetting.TheoryWeeklyNum = newSpecialtyPlanView.TheoryWeeklyNum;
- newTeachingSetting.PracticeWeeklyNum = newSpecialtyPlanView.PracticeWeeklyNum;
- newTeachingSetting.TrialWeeklyNum = newSpecialtyPlanView.TrialWeeklyNum;
- newTeachingSetting.WeeklyHours = newSpecialtyPlanView.WeeklyHours;
- newTeachingSetting.WeeklyNum = newSpecialtyPlanView.WeeklyNum;
- newTeachingSetting.StartWeeklyNum = newSpecialtyPlanView.StartWeeklyNum;
- newTeachingSetting.EndWeeklyNum = newSpecialtyPlanView.EndWeeklyNum;
- newTeachingSettingInList.Add(newTeachingSetting);
- }
- else
- {
- //可更新的相关信息
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.Credit = newSpecialtyPlanView.Credit;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = newSpecialtyPlanView.TheoryCourse;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = newSpecialtyPlanView.Practicehours;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = newSpecialtyPlanView.Trialhours;
- if (newExecutablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = newSpecialtyPlanView.TheoryWeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = newSpecialtyPlanView.PracticeWeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = newSpecialtyPlanView.TrialWeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = newSpecialtyPlanView.WeeklyHours;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = newSpecialtyPlanView.WeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = newSpecialtyPlanView.StartWeeklyNum;
- newExecutablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = newSpecialtyPlanView.EndWeeklyNum;
- }
- newTeachingSettingUpList.Add(newExecutablePlan.EM_ExecutablePlanTeachingSetting);
- }
- if (newExecutablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
- {
- //可更新的相关信息
- if (newSpecialtyPlanView.TeachingModeIDList != null && newSpecialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- executablePlanTMDelList.Add(newExecutablePlan.ExecutablePlanID);
- foreach (var newModeType in newSpecialtyPlanView.TeachingModeIDList.ToList())
- {
- var newTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newTeachingModeType.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newTeachingModeType);
- newTeachingModeTypeInList.Add(newTeachingModeType);
- }
- }
- else
- {
- executablePlanTMDelList.Add(newExecutablePlan.ExecutablePlanID);
- }
- }
- if (newSpecialtyPlanView.TeachingPlaceIDList != null && newSpecialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- executablePlanTPDelList.Add(newExecutablePlan.ExecutablePlanID);
- foreach (var newPlace in newSpecialtyPlanView.TeachingPlaceIDList.ToList())
- {
- var newTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newTeachingPlace.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newTeachingPlace);
- newTeachingPlaceInList.Add(newTeachingPlace);
- }
- }
- else
- {
- executablePlanTPDelList.Add(newExecutablePlan.ExecutablePlanID);
- }
- }
- executablePlanIDList.Add(newExecutablePlan.ExecutablePlanID);
- }
- }
- }
- }
- }
- }
- 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(newTeachingSettingInList);
- UnitOfWork.BulkInsert(newTeachingModeTypeInList);
- UnitOfWork.BulkInsert(newTeachingPlaceInList);
- //批量统一提交更新
- if (newExecutablePlanUpList != null && newExecutablePlanUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newExecutablePlanUpList);
- }
- //批量统一提交更新
- if (newProfileUpList != null && newProfileUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newProfileUpList);
- }
- //批量统一提交更新
- if (newTeachingSettingUpList != null && newTeachingSettingUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newTeachingSettingUpList);
- }
- ts.Complete();
- }
- if (fail > 0)
- {
- tipMessage = insert + "条,刷新成功" + update + "条,失败" + fail + "条,原因:学年学期小于入学学年学期或学年学期大于毕业学年学期,请检查";
- }
- else if (insert > 0 && update <= 0)
- {
- tipMessage = insert + "条";
- }
- else
- {
- tipMessage = insert + "条,刷新成功" + update + "条";
- }
- return tipMessage;
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 查询专业计划对应的授课方式List
- /// </summary>
- /// <param name="specialtyPlanID"></param>
- /// <returns></returns>
- public List<string> GetTeachingModeTypeList(Guid? specialtyPlanID)
- {
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- exp = exp.And(x => x.SpecialtyPlanID == specialtyPlanID);
- var query = SpecialtyPlanDAL.GetTeachingModeTypeQueryble(exp);
- return query.OrderBy(x => x.Value).Select(x => x.ToString()).ToList();
- }
- /// <summary>
- /// 查询专业计划对应的授课地点List
- /// </summary>
- /// <param name="specialtyPlanID"></param>
- /// <returns></returns>
- public List<string> GetTeachingPlaceList(Guid? specialtyPlanID)
- {
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- exp = exp.And(x => x.SpecialtyPlanID == specialtyPlanID);
- var query = SpecialtyPlanDAL.GetTeachingPlaceQueryble(exp);
- return query.OrderBy(x => x.Value).Select(x => x.ToString()).ToList();
- }
- /// <summary>
- /// 查询专业计划对应的计划范围信息ClassmajorView
- /// 注:注:普教版本(年级专业)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="specialtyPlanID"></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? specialtyPlanID,
- Guid? classmajorID, int? inSchoolStatus, int pageIndex, int pageSize)
- {
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.SpecialtyPlanID == specialtyPlanID);
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = InSchoolStatusSettingServices.Value.GetInschoolStatusList(true);
- if (inSchoolStatus == 1)
- {
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == 0)
- {
- //不在校
- expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- var query = SpecialtyPlanDAL.GetPlanRangeViewQueryable(expSpecialtyPlan, 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="specialtyPlanID"></param>
- /// <param name="classmajorID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <returns></returns>
- public IList<ClassmajorView> GetPlanRangeViewList(ConfiguretView configuretView, Guid? specialtyPlanID,
- Guid? classmajorID, int? inSchoolStatus)
- {
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.SpecialtyPlanID == specialtyPlanID);
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = InSchoolStatusSettingServices.Value.GetInschoolStatusList(true);
- if (inSchoolStatus == 1)
- {
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == 0)
- {
- //不在校
- expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- var query = SpecialtyPlanDAL.GetPlanRangeViewQueryable(expSpecialtyPlan, 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="specialtyPlanID"></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? specialtyPlanID,
- Guid? classmajorID, int? inSchoolStatus, int pageIndex, int pageSize)
- {
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.SpecialtyPlanID == specialtyPlanID);
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = InSchoolStatusSettingServices.Value.GetInschoolStatusList(true);
- if (inSchoolStatus == 1)
- {
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == 0)
- {
- //不在校
- expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- var query = SpecialtyPlanDAL.GetBaseStudentViewQueryable(expSpecialtyPlan, 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="specialtyPlanID"></param>
- /// <param name="classmajorID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <returns></returns>
- public IList<BaseStudentView> GetBaseStudentViewList(ConfiguretView configuretView, Guid? specialtyPlanID,
- Guid? classmajorID, int? inSchoolStatus)
- {
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.SpecialtyPlanID == specialtyPlanID);
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = InSchoolStatusSettingServices.Value.GetInschoolStatusList(true);
- if (inSchoolStatus == 1)
- {
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == 0)
- {
- //不在校
- expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- var query = SpecialtyPlanDAL.GetBaseStudentViewQueryable(expSpecialtyPlan, 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;
- }
- }
- /// <summary>
- /// 专业计划信息Excel导入
- /// 注:年级专业
- /// </summary>
- /// <param name="cellheader"></param>
- /// <param name="inCount"></param>
- /// <param name="upCount"></param>
- /// <param name="errdataList"></param>
- /// <param name="errCount"></param>
- /// <param name="sourcePhysicalPath"></param>
- public void SpecialtyPlanImport(Dictionary<string, string> cellheader, out int? inCount, out int? upCount, out List<SpecialtyPlanView> errdataList, out int? errCount, string sourcePhysicalPath)
- {
- try
- {
- StringBuilder errorMsg = new StringBuilder(); // 错误信息
- List<SpecialtyPlanView> errList = new List<SpecialtyPlanView>();
- // 1.1解析文件,存放到一个List集合里
- cellheader.Remove("ErrorMessage");//移除“未导入原因”列(ErrorMessage)
- List<SpecialtyPlanView> enlist = NpoiExcelHelper.ExcelToEntityList<SpecialtyPlanView>(cellheader, sourcePhysicalPath, out errorMsg, out errList);
- cellheader.Add("ErrorMessage", "未导入原因");
- //对List集合进行有效性校验
- if (enlist.Count() <= 0)
- {
- throw new Exception("Excel文件数据为空,请检查。");
- }
- Regex reg = null; //正则表达式
- //DateTime result; //用于返回判断日期字段格式
- bool isListPass = true; //List判断标识
- inCount = 0; //导入个数
- upCount = 0; //更新个数
- errCount = 0; //失败个数
- string errorMsgStr = ""; //错误信息
- List<EM_SpecialtyPlan> newSpecialtyPlanInList = new List<EM_SpecialtyPlan>();
- List<EM_SpecialtyPlan> newSpecialtyPlanUpList = new List<EM_SpecialtyPlan>();
- List<EM_SpecialtyPlanTeachingSetting> newTeachingSettingInList = new List<EM_SpecialtyPlanTeachingSetting>();
- List<EM_SpecialtyPlanTeachingSetting> newTeachingSettingUpList = new List<EM_SpecialtyPlanTeachingSetting>();
- List<EM_SpecialtyPlanTeachingModeType> newTeachingModeTypeInList = new List<EM_SpecialtyPlanTeachingModeType>();
- List<EM_SpecialtyPlanTeachingPlace> newTeachingPlaceInList = new List<EM_SpecialtyPlanTeachingPlace>();
- List<Guid?> specialtyPlanTMDelList = new List<Guid?>();
- List<Guid?> specialtyPlanTPDelList = new List<Guid?>();
- //将循环中相关数据库查询统一查询出来进行匹配(尽量避免在循环中进行数据库查询)
- //年级专业信息
- var grademajorList = SpecialtyPlanDAL.GrademajorRepository.GetList(x => true).ToList();
- //年级专业名称
- var grademajorNameList = enlist.Where(x => !string.IsNullOrEmpty(x.GrademajorName)).Select(x => x.GrademajorName.Trim()).ToList();
- //对比后的newGrademajorList
- var newGrademajorList = grademajorList.Where(x => grademajorNameList.Contains(x.Name)).ToList();
- //对比后的grademajorIDList
- var grademajorIDList = newGrademajorList.Select(x => (Guid?)x.GrademajorID).ToList();
- //开课学年
- var schoolyearNumList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_SchoolyearNum).ToList();
- //学期
- var schoolcodeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Semester).ToList();
- //学年学期
- var schoolyearList = SpecialtyPlanDAL.SchoolyearRepository.GetList(x => true).ToList();
- //课程信息
- var courseList = SpecialtyPlanDAL.CoursematerialRepository.GetList(x => true).ToList();
- //课程代码
- var courseCodeList = enlist.Where(x => !string.IsNullOrEmpty(x.CourseCode)).Select(x => x.CourseCode.Trim()).ToList();
- //对比后的newCourseList
- var newCourseList = courseList.Where(x => courseCodeList.Contains(x.CourseCode)).ToList();
- //对比后的coursematerialIDList
- var coursematerialIDList = newCourseList.Select(x => (Guid?)x.CoursematerialID).ToList();
- //课程结构
- var courseStructureList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseStructure).ToList();
- //课程属性
- var courseCategoryList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseCategory).ToList();
- //课程类型
- var courseTypeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseType).ToList();
- //课程性质
- var courseQualityList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseQuality).ToList();
- //教研室信息
- var departmentList = SpecialtyPlanDAL.DepartmentRepository.GetList(x => true).ToList();
- //开课教研室
- var departmentNameList = enlist.Where(x => !string.IsNullOrEmpty(x.DepartmentName)).Select(x => x.DepartmentName.Trim()).ToList();
- //对比后的newDepartmentList
- var newDepartmentList = departmentList.Where(x => departmentNameList.Contains(x.Name)).ToList();
- //是否启用
- var generalPurposeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_GeneralPurpose).ToList();
- //精品课程
- var courseFineList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseFine).ToList();
- //实践类型
- var practiceTypeList = IdNameExt.GetDictionaryItem(DictionaryItem.EM_PracticeType).ToList();
- //授课语言
- var teachinglanguageList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Teachinglanguage).ToList();
- //考试方式
- var examinationModeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_ExaminationMode).ToList();
- //成绩类型
- var resultTypeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_ResultType).ToList();
- //处理方式
- var handleModeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_HandleMode).ToList();
- //授课方式
- var teachingModeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_TeachingMode).ToList();
- //授课地点
- var teachingPlaceList = IdNameExt.GetDictionaryItem(DictionaryItem.EM_TeachingPlace).ToList();
- //专业计划
- var specialtyPlanList = SpecialtyPlanDAL.SpecialtyPlanRepository
- .GetList(x => true, (x => x.EM_SpecialtyPlanTeachingSetting)).ToList();
- //对比后的newSpecialtyPlanList(暂时只对比年级专业ID、课程信息ID)
- var newSpecialtyPlanList = specialtyPlanList.Where(x => grademajorIDList.Contains(x.GrademajorID)
- && coursematerialIDList.Contains(x.CoursematerialID)).ToList();
- //循环检测数据列,对各数据列进行验证(必填、字典项验证、数据格式等)
- for (int i = 0; i < enlist.Count; i++)
- {
- SpecialtyPlanView en = enlist[i]; //Excel表数据视图
- EM_SpecialtyPlan newSpecialtyPlan = new EM_SpecialtyPlan();
- EM_SpecialtyPlanTeachingSetting newTeachingSetting = new EM_SpecialtyPlanTeachingSetting();
- List<int> newModeTypeList = new List<int>();
- List<int> newPlaceList = new List<int>();
- //年级专业名称
- if (string.IsNullOrWhiteSpace(en.GrademajorName))
- {
- errCount++;
- errorMsgStr = "年级专业名称不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var grademajor = newGrademajorList.Where(x => x.Name == en.GrademajorName.Trim()).SingleOrDefault();
- if (grademajor == null)
- {
- errCount++;
- errorMsgStr = "年级专业名称不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //年级专业ID
- newSpecialtyPlan.GrademajorID = grademajor.GrademajorID;
- //年级
- en.GradeID = grademajor.GradeID;
- //入学学期
- en.StartSchoolcodeID = grademajor.SemesterID;
- //毕业学期
- en.GraduatingSemesterID = grademajor.GraduateSchoolyearID;
- }
- }
- //开课学年
- if (string.IsNullOrWhiteSpace(en.SchoolyearNumStr))
- {
- errCount++;
- errorMsgStr = "开课学年不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var schoolyearNum = schoolyearNumList.Where(x => x.Name == en.SchoolyearNumStr.Trim()).SingleOrDefault();
- if (schoolyearNum == null)
- {
- errCount++;
- errorMsgStr = "开课学年不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //开课学年
- en.SchoolyearNumID = schoolyearNum.Value;
- }
- }
- //学期
- if (string.IsNullOrWhiteSpace(en.SchoolcodeStr))
- {
- errCount++;
- errorMsgStr = "学期不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var schoolcode = schoolcodeList.Where(x => x.Name == en.SchoolcodeStr.Trim()).SingleOrDefault();
- if (schoolcode == null)
- {
- errCount++;
- errorMsgStr = "学期不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //学期
- en.SchoolcodeID = schoolcode.Value;
- }
- }
- //学年学期
- if (string.IsNullOrWhiteSpace(en.SchoolyearCode))
- {
- //暂不考虑
- }
- else
- {
- //暂不考虑
- }
- //查询对应的学年学期ID且匹配对应的学年学期(学年学期不为空时)
- if (en.GradeID.HasValue && en.StartSchoolcodeID.HasValue && en.GraduatingSemesterID.HasValue && en.SchoolyearNumID.HasValue && en.SchoolcodeID.HasValue)
- {
- //查询年级专业对应的入学学年学期信息
- var startSchoolyear = schoolyearList.Where(x => x.Years == en.GradeID && x.SchoolcodeID == en.StartSchoolcodeID).SingleOrDefault();
- if (startSchoolyear == null)
- {
- errCount++;
- errorMsgStr = "年级专业对应的入学学期不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //查询年级专业对应的毕业学年学期信息
- var graduatingSemester = schoolyearList.Where(x => x.SchoolyearID == en.GraduatingSemesterID).SingleOrDefault();
- if (graduatingSemester == null)
- {
- errCount++;
- errorMsgStr = "年级专业对应的毕业学期不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //查询对应的学年学期信息
- var yearID = Convert.ToInt32(en.GradeID + en.SchoolyearNumID - 1);
- var schoolyear = schoolyearList.Where(x => x.Years == yearID && x.SchoolcodeID == en.SchoolcodeID).SingleOrDefault();
- if (schoolyear == null)
- {
- errCount++;
- errorMsgStr = "无法计算出对应的学年学期信息(以开课学年、学期、年级计算),请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //判断学年学期(以计算出的学年学期为准)
- if (string.IsNullOrWhiteSpace(en.SchoolyearCode))
- {
- //暂不考虑
- }
- else
- {
- //学年学期与计算出的学年学期不对应
- if (schoolyear.Code.Trim() != en.SchoolyearCode.Trim())
- {
- errCount++;
- errorMsgStr = "学年学期与计算出的学年学期不对应(以计算出的学年学期为准),请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- }
- //学年学期小于入学学年学期
- if (schoolyear.Value < startSchoolyear.Value)
- {
- errCount++;
- errorMsgStr = "学年学期小于年级专业对应的入学学年学期(以计算出的学年学期为准),请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- //学年学期大于毕业学年学期
- if (schoolyear.Value > graduatingSemester.Value)
- {
- errCount++;
- errorMsgStr = "学年学期大于年级专业对应的毕业学年学期(以计算出的学年学期为准),请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- //学年学期ID
- newSpecialtyPlan.SchoolyearID = schoolyear.SchoolyearID;
- }
- }
- }
- }
- else
- {
- errCount++;
- errorMsgStr = "数据有误,请检查(开课学年、学期、年级、入学学期或毕业学期不能为空)";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- //课程代码
- if (string.IsNullOrWhiteSpace(en.CourseCode))
- {
- errCount++;
- errorMsgStr = "课程代码不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- reg = new Regex(@"^[0-9a-zA-Z\s?]+$"); //正则表达式(请输入数字或英文字母)
- if (!reg.IsMatch(en.CourseCode.Trim()))
- {
- errCount++;
- errorMsgStr = "课程代码格式不正确,请检查(数字或英文字母)";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var course = newCourseList.Where(x => x.CourseCode == en.CourseCode.Trim()).SingleOrDefault();
- if (course == null)
- {
- errCount++;
- errorMsgStr = "课程代码不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //判断课程代码与课程名称(以课程代码为准)
- if (string.IsNullOrWhiteSpace(en.CourseName))
- {
- //暂不考虑
- }
- else
- {
- //课程代码与课程名称不对应
- if (course.CourseName.Trim() != en.CourseName.Trim())
- {
- errCount++;
- errorMsgStr = "课程代码与课程名称不对应(以课程代码为准),请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- }
- //判断对应的课程信息状态(启用、禁用状态)
- if (course.IsEnable == true)
- {
- //课程信息ID
- newSpecialtyPlan.CoursematerialID = course.CoursematerialID;
- }
- else
- {
- newSpecialtyPlan.CoursematerialID = course.CoursematerialID;
- errCount++;
- errorMsgStr = "对应的课程信息为禁用状态,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- }
- }
- }
- //课程名称
- if (string.IsNullOrWhiteSpace(en.CourseName))
- {
- //暂不考虑
- }
- else
- {
- //暂不考虑
- }
- //课程结构
- if (string.IsNullOrWhiteSpace(en.CourseStructureStr))
- {
- newSpecialtyPlan.CourseStructureID = (int)CF_CourseStructure.ClassroomTeaching;
- }
- else
- {
- var courseStructure = courseStructureList.Where(x => x.Name == en.CourseStructureStr.Trim()).SingleOrDefault();
- if (courseStructure == null)
- {
- errCount++;
- errorMsgStr = "课程结构不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //课程结构
- newSpecialtyPlan.CourseStructureID = courseStructure.Value;
- }
- }
- //课程属性
- if (string.IsNullOrWhiteSpace(en.CourseCategoryStr))
- {
- newSpecialtyPlan.CourseCategoryID = (int)CF_CourseCategory.Publiccourse;
- }
- else
- {
- var courseCategory = courseCategoryList.Where(x => x.Name == en.CourseCategoryStr.Trim()).SingleOrDefault();
- if (courseCategory == null)
- {
- errCount++;
- errorMsgStr = "课程属性不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //课程属性
- newSpecialtyPlan.CourseCategoryID = courseCategory.Value;
- }
- }
- //课程类型
- if (string.IsNullOrWhiteSpace(en.CourseTypeStr))
- {
- errCount++;
- errorMsgStr = "课程类型不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var courseType = courseTypeList.Where(x => x.Name == en.CourseTypeStr.Trim()).SingleOrDefault();
- if (courseType == null)
- {
- errCount++;
- errorMsgStr = "课程类型不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //课程类型
- newSpecialtyPlan.CourseTypeID = courseType.Value;
- }
- }
- //课程性质
- if (string.IsNullOrWhiteSpace(en.CourseQualityStr))
- {
- newSpecialtyPlan.CourseQualityID = (int)CF_CourseQuality.Required;
- }
- else
- {
- var courseQuality = courseQualityList.Where(x => x.Name == en.CourseQualityStr.Trim()).SingleOrDefault();
- if (courseQuality == null)
- {
- errCount++;
- errorMsgStr = "课程性质不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //课程性质
- newSpecialtyPlan.CourseQualityID = courseQuality.Value;
- }
- }
- //课程学分
- if (string.IsNullOrWhiteSpace(en.CreditStr))
- {
- errCount++;
- errorMsgStr = "课程学分不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- reg = new Regex(@"^[0-9]+([.]{1}[0-9]+){0,1}$"); //课程学分字段正则表达式()
- if (!reg.IsMatch(en.CreditStr.Trim()))
- {
- errCount++;
- errorMsgStr = "课程学分格式不正确,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //课程学分
- newTeachingSetting.Credit = Convert.ToDecimal(en.CreditStr.Trim());
- }
- }
- //理论学时
- if (string.IsNullOrWhiteSpace(en.TheoryCourseStr))
- {
- errCount++;
- errorMsgStr = "理论学时不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- reg = new Regex(@"^\d+$"); //正则表达式(非负整数)
- if (!reg.IsMatch(en.TheoryCourseStr.Trim()))
- {
- errCount++;
- errorMsgStr = "理论学时格式不正确,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //理论学时
- newTeachingSetting.TheoryCourse = Convert.ToInt32(en.TheoryCourseStr.Trim());
- }
- }
- //实践学时
- if (string.IsNullOrWhiteSpace(en.PracticehoursStr))
- {
- errCount++;
- errorMsgStr = "实践学时不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- reg = new Regex(@"^\d+$"); //正则表达式(非负整数)
- if (!reg.IsMatch(en.PracticehoursStr.Trim()))
- {
- errCount++;
- errorMsgStr = "实践学时格式不正确,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //实践学时
- newTeachingSetting.Practicehours = Convert.ToInt32(en.PracticehoursStr.Trim());
- }
- }
- //实验学时
- if (string.IsNullOrWhiteSpace(en.TrialhoursStr))
- {
- newTeachingSetting.Trialhours = 0;
- }
- else
- {
- reg = new Regex(@"^\d+$"); //正则表达式(非负整数)
- if (!reg.IsMatch(en.TrialhoursStr.Trim()))
- {
- errCount++;
- errorMsgStr = "实验学时格式不正确,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //实验学时
- newTeachingSetting.Trialhours = Convert.ToInt32(en.TrialhoursStr.Trim());
- }
- }
- //理论周次
- if (string.IsNullOrWhiteSpace(en.TheoryWeeklyNumStr))
- {
- newTeachingSetting.TheoryWeeklyNum = 0;
- }
- else
- {
- reg = new Regex(@"^\d+$"); //正则表达式(非负整数)
- if (!reg.IsMatch(en.TheoryWeeklyNumStr.Trim()))
- {
- errCount++;
- errorMsgStr = "理论周次格式不正确,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //理论周次
- newTeachingSetting.TheoryWeeklyNum = Convert.ToInt32(en.TheoryWeeklyNumStr.Trim());
- }
- }
- //实践周次
- if (string.IsNullOrWhiteSpace(en.PracticeWeeklyNumStr))
- {
- newTeachingSetting.PracticeWeeklyNum = 0;
- }
- else
- {
- reg = new Regex(@"^\d+$"); //正则表达式(非负整数)
- if (!reg.IsMatch(en.PracticeWeeklyNumStr.Trim()))
- {
- errCount++;
- errorMsgStr = "实践周次格式不正确,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //实践周次
- newTeachingSetting.PracticeWeeklyNum = Convert.ToInt32(en.PracticeWeeklyNumStr.Trim());
- }
- }
- //实验周次
- if (string.IsNullOrWhiteSpace(en.TrialWeeklyNumStr))
- {
- newTeachingSetting.TrialWeeklyNum = 0;
- }
- else
- {
- reg = new Regex(@"^\d+$"); //正则表达式(非负整数)
- if (!reg.IsMatch(en.TrialWeeklyNumStr.Trim()))
- {
- errCount++;
- errorMsgStr = "实验周次格式不正确,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //实践周次
- newTeachingSetting.TrialWeeklyNum = Convert.ToInt32(en.TrialWeeklyNumStr.Trim());
- }
- }
- //开课教研室
- if (string.IsNullOrWhiteSpace(en.DepartmentName))
- {
- errCount++;
- errorMsgStr = "开课教研室不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var department = newDepartmentList.Where(x => x.Name == en.DepartmentName.Trim()).SingleOrDefault();
- if (department == null)
- {
- errCount++;
- errorMsgStr = "开课教研室不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //教研室信息ID
- newSpecialtyPlan.DepartmentID = department.DepartmentID;
- }
- }
- //是否专业核心
- if (string.IsNullOrWhiteSpace(en.IsSpecialtycoreStr))
- {
- //是否专业核心(默认为否)
- newSpecialtyPlan.IsSpecialtycore = false;
- }
- else
- {
- var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsSpecialtycoreStr.Trim()).SingleOrDefault();
- if (generalPurpose == null)
- {
- errCount++;
- errorMsgStr = "是否专业核心不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //是否专业核心
- newSpecialtyPlan.IsSpecialtycore = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
- }
- }
- //是否合作开发
- if (string.IsNullOrWhiteSpace(en.IsCooperationStr))
- {
- //是否合作开发(默认为否)
- newSpecialtyPlan.IsCooperation = false;
- }
- else
- {
- var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsCooperationStr.Trim()).SingleOrDefault();
- if (generalPurpose == null)
- {
- errCount++;
- errorMsgStr = "是否合作开发不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //是否合作开发
- newSpecialtyPlan.IsCooperation = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
- }
- }
- //是否必修课
- if (string.IsNullOrWhiteSpace(en.IsRequiredStr))
- {
- //是否必修课(默认为否)
- newSpecialtyPlan.IsRequired = false;
- }
- else
- {
- var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsRequiredStr.Trim()).SingleOrDefault();
- if (generalPurpose == null)
- {
- errCount++;
- errorMsgStr = RSL.Get("IsRequired") + "不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //是否必修课
- newSpecialtyPlan.IsRequired = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
- }
- }
- //是否网上选修
- if (string.IsNullOrWhiteSpace(en.IsElectiveStr))
- {
- //是否网上选修(默认为否)
- newSpecialtyPlan.IsElective = false;
- }
- else
- {
- var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsElectiveStr.Trim()).SingleOrDefault();
- if (generalPurpose == null)
- {
- errCount++;
- errorMsgStr = "是否网上选修不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //是否网上选修
- newSpecialtyPlan.IsElective = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
- }
- }
- //是否网络课程
- if (string.IsNullOrWhiteSpace(en.IsNetworkCourseStr))
- {
- //是否网络课程(默认为否)
- newSpecialtyPlan.IsNetworkCourse = false;
- }
- else
- {
- var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsNetworkCourseStr.Trim()).SingleOrDefault();
- if (generalPurpose == null)
- {
- errCount++;
- errorMsgStr = "是否网络课程不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //是否网络课程
- newSpecialtyPlan.IsNetworkCourse = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
- }
- }
- //是否学位课程
- if (string.IsNullOrWhiteSpace(en.IsMainCourseStr))
- {
- //是否学位课程(默认为否)
- newSpecialtyPlan.IsMainCourse = false;
- }
- else
- {
- var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsMainCourseStr.Trim()).SingleOrDefault();
- if (generalPurpose == null)
- {
- errCount++;
- errorMsgStr = "是否学位课程不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //是否学位课程
- newSpecialtyPlan.IsMainCourse = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
- }
- }
- //是否需要教材
- if (string.IsNullOrWhiteSpace(en.IsNeedMaterialStr))
- {
- //是否需要教材(默认为是)
- newSpecialtyPlan.IsNeedMaterial = true;
- }
- else
- {
- var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsNeedMaterialStr.Trim()).SingleOrDefault();
- if (generalPurpose == null)
- {
- errCount++;
- errorMsgStr = "是否需要教材不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //是否需要教材
- newSpecialtyPlan.IsNeedMaterial = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
- }
- }
- //精品课程
- if (string.IsNullOrWhiteSpace(en.CourseFineStr))
- {
- newSpecialtyPlan.CourseFineID = (int)CF_CourseFine.No;
- }
- else
- {
- var courseFine = courseFineList.Where(x => x.Name == en.CourseFineStr.Trim()).SingleOrDefault();
- if (courseFine == null)
- {
- errCount++;
- errorMsgStr = "精品课程不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //精品课程
- newSpecialtyPlan.CourseFineID = courseFine.Value;
- }
- }
- //实践类型
- if (string.IsNullOrWhiteSpace(en.PracticeTypeStr))
- {
- //不考虑
- }
- else
- {
- var practiceType = practiceTypeList.Where(x => x.Name == en.PracticeTypeStr.Trim()).SingleOrDefault();
- if (practiceType == null)
- {
- errCount++;
- errorMsgStr = "实践类型不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //实践类型
- newSpecialtyPlan.PracticeTypeID = practiceType.Value;
- }
- }
- //授课语言
- if (string.IsNullOrWhiteSpace(en.TeachinglanguageStr))
- {
- newSpecialtyPlan.TeachinglanguageID = (int)CF_Teachinglanguage.Chinese;
- }
- else
- {
- var teachinglanguage = teachinglanguageList.Where(x => x.Name == en.TeachinglanguageStr.Trim()).SingleOrDefault();
- if (teachinglanguage == null)
- {
- errCount++;
- errorMsgStr = "授课语言不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //授课语言
- newSpecialtyPlan.TeachinglanguageID = teachinglanguage.Value;
- }
- }
- //考试方式
- if (string.IsNullOrWhiteSpace(en.ExaminationModeStr))
- {
- newSpecialtyPlan.ExaminationModeID = (int)CF_ExaminationMode.WrittenExam;
- }
- else
- {
- var examinationMode = examinationModeList.Where(x => x.Name == en.ExaminationModeStr.Trim()).SingleOrDefault();
- if (examinationMode == null)
- {
- errCount++;
- errorMsgStr = "考试方式不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //考试方式
- newSpecialtyPlan.ExaminationModeID = examinationMode.Value;
- }
- }
- //成绩类型
- if (string.IsNullOrWhiteSpace(en.ResultTypeStr))
- {
- newSpecialtyPlan.ResultTypeID = (int)CF_ResultType.Percentage;
- }
- else
- {
- var resultType = resultTypeList.Where(x => x.Name == en.ResultTypeStr.Trim()).SingleOrDefault();
- if (resultType == null)
- {
- errCount++;
- errorMsgStr = "成绩类型不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //成绩类型
- newSpecialtyPlan.ResultTypeID = resultType.Value;
- }
- }
- //处理方式
- if (string.IsNullOrWhiteSpace(en.HandleModeStr))
- {
- newSpecialtyPlan.HandleModeID = (int)CF_HandleMode.RequiredCourse;
- }
- else
- {
- var handleMode = handleModeList.Where(x => x.Name == en.HandleModeStr.Trim()).SingleOrDefault();
- if (handleMode == null)
- {
- errCount++;
- errorMsgStr = "处理方式不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //处理方式
- newSpecialtyPlan.HandleModeID = handleMode.Value;
- }
- }
- //授课方式
- if (string.IsNullOrWhiteSpace(en.TeachingModeIDListStr))
- {
- newModeTypeList.Add((int)CF_TeachingMode.Theory);
- }
- else
- {
- //授课方式可为多个(可用顿号隔开)
- List<string> list = en.TeachingModeIDListStr.Split('、').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => x.Trim()).Distinct().ToList();
- foreach (var item in list)
- {
- var teachingMode = teachingModeList.Where(x => x.Name == item.Trim()).SingleOrDefault();
- if (teachingMode == null)
- {
- errCount++;
- errorMsgStr = "授课方式(" + item.Trim() + ")不存在,请检查(存在多个授课方式时,可用顿号隔开)";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- isListPass = false;
- break;
- }
- }
- if (isListPass)
- {
- newModeTypeList = teachingModeList.Where(x => list.Contains(x.Name))
- .Select(x => x.Value.Value).ToList();
- }
- else
- {
- isListPass = true;
- continue;
- }
- }
- //授课地点
- if (string.IsNullOrWhiteSpace(en.TeachingPlaceIDListStr))
- {
- newPlaceList.Add((int)EMIS.ViewModel.EM_TeachingPlace.Multimedia);
- }
- else
- {
- //授课地点可为多个(可用顿号隔开)
- List<string> list = en.TeachingPlaceIDListStr.Split('、').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => x.Trim()).Distinct().ToList();
- foreach (var item in list)
- {
- var teachingPlace = teachingPlaceList.Where(x => x.Name == item.Trim()).SingleOrDefault();
- if (teachingPlace == null)
- {
- errCount++;
- errorMsgStr = "授课地点(" + item.Trim() + ")不存在,请检查(存在多个授课地点时,可用顿号隔开)";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- isListPass = false;
- break;
- }
- }
- if (isListPass)
- {
- newPlaceList = teachingPlaceList.Where(x => list.Contains(x.Name))
- .Select(x => x.Value.Value).ToList();
- }
- else
- {
- isListPass = true;
- continue;
- }
- }
- //备注
- if (string.IsNullOrWhiteSpace(en.Remark))
- {
- //不考虑
- }
- else
- {
- newSpecialtyPlan.Remark = en.Remark;
- }
- ////Excel表重复性验证(注:当数据表中没有此记录,但是Excel中有重复数据时的去掉)
- //for (int j = i + 1; j < enlist.Count; j++)
- //{
- // SpecialtyPlanView enA = enlist[j];
- // //根据Excel表中的业务主键进行去重(学年学期ID、年级专业ID、课程信息ID唯一)
- // if (en.No == enA.No && en.Name == enA.Name)
- // {
- // //用于标识Excel表中的重复记录(由于是批量进行插入数据表)
- // }
- //}
- //数据表重复性验证(学年学期ID、年级专业ID、课程信息ID唯一)
- var specialtyPlanVerification = newSpecialtyPlanList.Where(x => x.SchoolyearID == newSpecialtyPlan.SchoolyearID
- && x.GrademajorID == newSpecialtyPlan.GrademajorID
- && x.CoursematerialID == newSpecialtyPlan.CoursematerialID).SingleOrDefault();
- if (specialtyPlanVerification == null)
- {
- //新增
- if (!newSpecialtyPlanInList.Any(x => x.SchoolyearID == newSpecialtyPlan.SchoolyearID
- && x.GrademajorID == newSpecialtyPlan.GrademajorID
- && x.CoursematerialID == newSpecialtyPlan.CoursematerialID))
- {
- newSpecialtyPlan.SpecialtyPlanID = Guid.NewGuid();
- SetNewStatus(newSpecialtyPlan);
- newSpecialtyPlanInList.Add(newSpecialtyPlan);
- newTeachingSetting.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- //newTeachingSetting.TheoryWeeklyNum = 0;
- //newTeachingSetting.PracticeWeeklyNum = 0;
- //newTeachingSetting.TrialWeeklyNum = 0;
- newTeachingSetting.WeeklyHours = 0;
- newTeachingSetting.WeeklyNum = 0;
- newTeachingSetting.StartWeeklyNum = 1;
- newTeachingSetting.EndWeeklyNum = 16;
- newTeachingSettingInList.Add(newTeachingSetting);
- if (newModeTypeList != null && newModeTypeList.Count() > 0)
- {
- foreach (var newModeType in newModeTypeList)
- {
- var newTeachingModeType = new EM_SpecialtyPlanTeachingModeType();
- newTeachingModeType.SpecialtyPlanTeachingModeTypeID = Guid.NewGuid();
- newTeachingModeType.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- newTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newTeachingModeType);
- newTeachingModeTypeInList.Add(newTeachingModeType);
- }
- }
- if (newPlaceList != null && newPlaceList.Count() > 0)
- {
- foreach (var newPlace in newPlaceList)
- {
- var newTeachingPlace = new EM_SpecialtyPlanTeachingPlace();
- newTeachingPlace.SpecialtyPlanTeachingPlaceID = Guid.NewGuid();
- newTeachingPlace.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- newTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newTeachingPlace);
- newTeachingPlaceInList.Add(newTeachingPlace);
- }
- }
- inCount++;
- }
- else
- {
- //Excel表重复性验证
- //(注:当数据表中没有此记录,但是Excel中有重复数据,可在此处进行抛出到失败数据文件中,目前暂不考虑)
- inCount++;
- }
- }
- else
- {
- //更新(Excel有重复时,以最后一条记录的更新为准)
- specialtyPlanVerification.CourseStructureID = newSpecialtyPlan.CourseStructureID;
- specialtyPlanVerification.CourseCategoryID = newSpecialtyPlan.CourseCategoryID;
- specialtyPlanVerification.CourseTypeID = newSpecialtyPlan.CourseTypeID;
- specialtyPlanVerification.CourseQualityID = newSpecialtyPlan.CourseQualityID;
- specialtyPlanVerification.DepartmentID = newSpecialtyPlan.DepartmentID;
- specialtyPlanVerification.IsSpecialtycore = newSpecialtyPlan.IsSpecialtycore;
- specialtyPlanVerification.IsCooperation = newSpecialtyPlan.IsCooperation;
- specialtyPlanVerification.IsRequired = newSpecialtyPlan.IsRequired;
- specialtyPlanVerification.IsElective = newSpecialtyPlan.IsElective;
- specialtyPlanVerification.IsNetworkCourse = newSpecialtyPlan.IsNetworkCourse;
- specialtyPlanVerification.IsMainCourse = newSpecialtyPlan.IsMainCourse;
- specialtyPlanVerification.IsNeedMaterial = newSpecialtyPlan.IsNeedMaterial;
- specialtyPlanVerification.CourseFineID = newSpecialtyPlan.CourseFineID;
- specialtyPlanVerification.PracticeTypeID = newSpecialtyPlan.PracticeTypeID;
- specialtyPlanVerification.TeachinglanguageID = newSpecialtyPlan.TeachinglanguageID;
- specialtyPlanVerification.ExaminationModeID = newSpecialtyPlan.ExaminationModeID;
- specialtyPlanVerification.ResultTypeID = newSpecialtyPlan.ResultTypeID;
- specialtyPlanVerification.HandleModeID = newSpecialtyPlan.HandleModeID;
- specialtyPlanVerification.Remark = newSpecialtyPlan.Remark;
- SetModifyStatus(specialtyPlanVerification);
- newSpecialtyPlanUpList.Add(specialtyPlanVerification);
- if (specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting == null)
- {
- if (newTeachingSettingInList.Any(x => x.SpecialtyPlanID == specialtyPlanVerification.SpecialtyPlanID))
- {
- newTeachingSettingInList.RemoveAll(x => x.SpecialtyPlanID == specialtyPlanVerification.SpecialtyPlanID);
- }
- newTeachingSetting.SpecialtyPlanID = specialtyPlanVerification.SpecialtyPlanID;
- //newTeachingSetting.TheoryWeeklyNum = 0;
- //newTeachingSetting.PracticeWeeklyNum = 0;
- //newTeachingSetting.TrialWeeklyNum = 0;
- newTeachingSetting.WeeklyHours = 0;
- newTeachingSetting.WeeklyNum = 0;
- newTeachingSetting.StartWeeklyNum = 1;
- newTeachingSetting.EndWeeklyNum = 16;
- newTeachingSettingInList.Add(newTeachingSetting);
- }
- else
- {
- specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.Credit = newTeachingSetting.Credit;
- specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.TheoryCourse = newTeachingSetting.TheoryCourse;
- specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.Practicehours = newTeachingSetting.Practicehours;
- specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.Trialhours = newTeachingSetting.Trialhours;
- specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.TheoryWeeklyNum = newTeachingSetting.TheoryWeeklyNum;
- specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.PracticeWeeklyNum = newTeachingSetting.PracticeWeeklyNum;
- specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.TrialWeeklyNum = newTeachingSetting.TrialWeeklyNum;
- newTeachingSettingUpList.Add(specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting);
- }
- if (newModeTypeList != null && newModeTypeList.Count() > 0)
- {
- if (newTeachingModeTypeInList.Any(x => x.SpecialtyPlanID == specialtyPlanVerification.SpecialtyPlanID))
- {
- newTeachingModeTypeInList.RemoveAll(x => x.SpecialtyPlanID == specialtyPlanVerification.SpecialtyPlanID);
- }
- specialtyPlanTMDelList.Add(specialtyPlanVerification.SpecialtyPlanID);
- foreach (var newModeType in newModeTypeList)
- {
- var newTeachingModeType = new EM_SpecialtyPlanTeachingModeType();
- newTeachingModeType.SpecialtyPlanTeachingModeTypeID = Guid.NewGuid();
- newTeachingModeType.SpecialtyPlanID = specialtyPlanVerification.SpecialtyPlanID;
- newTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newTeachingModeType);
- newTeachingModeTypeInList.Add(newTeachingModeType);
- }
- }
- else
- {
- specialtyPlanTMDelList.Add(specialtyPlanVerification.SpecialtyPlanID);
- }
- if (newPlaceList != null && newPlaceList.Count() > 0)
- {
- if (newTeachingPlaceInList.Any(x => x.SpecialtyPlanID == specialtyPlanVerification.SpecialtyPlanID))
- {
- newTeachingPlaceInList.RemoveAll(x => x.SpecialtyPlanID == specialtyPlanVerification.SpecialtyPlanID);
- }
- specialtyPlanTPDelList.Add(specialtyPlanVerification.SpecialtyPlanID);
- foreach (var newPlace in newPlaceList)
- {
- var newTeachingPlace = new EM_SpecialtyPlanTeachingPlace();
- newTeachingPlace.SpecialtyPlanTeachingPlaceID = Guid.NewGuid();
- newTeachingPlace.SpecialtyPlanID = specialtyPlanVerification.SpecialtyPlanID;
- newTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newTeachingPlace);
- newTeachingPlaceInList.Add(newTeachingPlace);
- }
- }
- else
- {
- specialtyPlanTPDelList.Add(specialtyPlanVerification.SpecialtyPlanID);
- }
- upCount++;
- }
- }
- using (TransactionScope ts = new TransactionScope())
- {
- //删除
- UnitOfWork.Delete<EM_SpecialtyPlanTeachingPlace>(x => specialtyPlanTPDelList.Contains(x.SpecialtyPlanID));
- UnitOfWork.Delete<EM_SpecialtyPlanTeachingModeType>(x => specialtyPlanTMDelList.Contains(x.SpecialtyPlanID));
- //批量插入
- UnitOfWork.BulkInsert(newSpecialtyPlanInList);
- UnitOfWork.BulkInsert(newTeachingSettingInList);
- UnitOfWork.BulkInsert(newTeachingModeTypeInList);
- UnitOfWork.BulkInsert(newTeachingPlaceInList);
- //批量统一提交更新
- if (newSpecialtyPlanUpList != null && newSpecialtyPlanUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newSpecialtyPlanUpList);
- }
- //批量统一提交更新
- if (newTeachingSettingUpList != null && newTeachingSettingUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newTeachingSettingUpList);
- }
- ts.Complete();
- }
- errdataList = errList.Distinct().ToList(); //错误列表List
- }
- catch (Exception)
- {
- throw;
- }
- }
- }
- }
|