12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728 |
- 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.UniversityManage.SpecialtyClassManage;
- using EMIS.ViewModel.Students;
- using EMIS.DataLogic.CultureplanManage.PlanManagement;
- using EMIS.DataLogic.EducationManage;
- using EMIS.CommonLogic.StudentManage.StudentStatistics;
- namespace EMIS.CommonLogic.CultureplanManage.PlanManagement
- {
- public class AdultSpecialtyPlanServices : BaseServices, IAdultSpecialtyPlanServices
- {
- public SpecialtyPlanDAL SpecialtyPlanDAL { get; set; }
- public ExecutablePlanDAL ExecutablePlanDAL { get; set; }
- public Lazy<IInSchoolSettingServices> InSchoolSettingServices { get; set; }
- /// <summary>
- /// 查询对应的专业计划信息SpecialtyPlanView
- /// 注:成教版本(入学学年学期、专业信息)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="departmentID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="courseTypeID"></param>
- /// <param name="isMainCourse"></param>
- /// <param name="teachingModeID"></param>
- /// <param name="handleModeID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<SpecialtyPlanView> GetAdultSpecialtyPlanViewGrid(ConfiguretView configuretView, Guid? schoolyearID, Guid? departmentID,
- int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? coursematerialID,
- int? courseTypeID, int? isMainCourse, 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 (departmentID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.DepartmentID == departmentID);
- }
- if (coursematerialID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
- }
- if (courseTypeID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.CourseTypeID == courseTypeID);
- }
- if (isMainCourse.HasValue)
- {
- //是否学位课程
- if (isMainCourse == (int)CF_GeneralPurpose.IsYes)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.IsMainCourse == true);
- }
- if (isMainCourse == (int)CF_GeneralPurpose.IsNo)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.IsMainCourse != true);
- }
- }
- 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.GetAdultSpecialtyPlanViewQueryable(expSpecialtyPlan, expStudent);
- 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.GradeID).ThenBy(x => x.StandardID)
- .ThenBy(x => x.EducationID).ThenBy(x => x.LearningformID)
- .ThenBy(x => x.LearnSystem).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="departmentID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="courseTypeID"></param>
- /// <param name="isMainCourse"></param>
- /// <param name="teachingModeID"></param>
- /// <param name="handleModeID"></param>
- /// <returns></returns>
- public IList<SpecialtyPlanView> GetAdultSpecialtyPlanViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? departmentID,
- int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? coursematerialID,
- int? courseTypeID, int? isMainCourse, 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 (departmentID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.DepartmentID == departmentID);
- }
- if (coursematerialID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
- }
- if (courseTypeID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.CourseTypeID == courseTypeID);
- }
- if (isMainCourse.HasValue)
- {
- //是否学位课程
- if (isMainCourse == (int)CF_GeneralPurpose.IsYes)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.IsMainCourse == true);
- }
- if (isMainCourse == (int)CF_GeneralPurpose.IsNo)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.IsMainCourse != true);
- }
- }
- 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.GetAdultSpecialtyPlanViewQueryable(expSpecialtyPlan, expStudent);
- 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.GradeID).ThenBy(x => x.StandardID)
- .ThenBy(x => x.EducationID).ThenBy(x => x.LearningformID)
- .ThenBy(x => x.LearnSystem).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 GetAdultSpecialtyPlanView(Guid? specialtyPlanID)
- {
- try
- {
- var specialtyPlanView = SpecialtyPlanDAL.GetAdultSpecialtyPlanViewQueryable(x => x.SpecialtyPlanID == specialtyPlanID).SingleOrDefault();
- return specialtyPlanView;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 编辑(新增、修改,业务主键:学年学期ID、入学学年学期ID、专业信息ID、课程信息ID)
- /// 注:刷新相关的执行计划信息
- /// </summary>
- /// <param name="specialtyPlanView"></param>
- public void AdultSpecialtyPlanEdit(SpecialtyPlanView specialtyPlanView)
- {
- try
- {
- //查询对应的专业信息
- var specialty = SpecialtyPlanDAL.SpecialtyRepository
- .GetList(x => x.SpecialtyID == specialtyPlanView.SpecialtyID).SingleOrDefault();
- if (specialty == 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 == specialtyPlanView.GradeID
- && x.SchoolcodeID == specialtyPlanView.StartSchoolcodeID).SingleOrDefault();
- if (startSchoolyear == null)
- {
- throw new Exception("入学学期、年级对应的入学学年学期信息不存在,请检查。");
- }
- //查询对应的毕业学年学期信息(根据入学学期、年级和专业信息对应的学制计算)
- var graduateSchoolyearValue = (specialtyPlanView.GradeID.Value * 2) - 1
- + (specialtyPlanView.StartSchoolcodeID.Value - 1);
- graduateSchoolyearValue += Convert.ToInt32(Math.Ceiling(specialty.LearnSystem.Value * 2 - 1));
- var graduatingSemester = schoolyearList.Where(x => x.Value == graduateSchoolyearValue).SingleOrDefault();
- if (graduatingSemester == null)
- {
- throw new Exception("入学学期、年级和专业信息对应的毕业学年学期信息不存在,请检查。");
- }
- //查询对应的学年学期信息
- var schoolyear = schoolyearList.Where(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.StartSchoolyearID == startSchoolyear.SchoolyearID
- && x.SpecialtyID == specialty.SpecialtyID
- && x.CoursematerialID == specialtyPlanView.CoursematerialID).SingleOrDefault();
- if (specialtyPlanVerify == null)
- {
- //学年学期
- Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSchoolyear = expSchoolyear.And(x => x.Years == specialtyPlanView.GradeID);
- expSchoolyear = expSchoolyear.And(x => x.SchoolcodeID == specialtyPlanView.StartSchoolcodeID);
- //专业信息
- Expression<Func<CF_Specialty, bool>> expSpecialty = (x => x.RecordStatus >= (int)SYS_STATUS.UNUSABLE);
- expSpecialty = expSpecialty.And(x => x.SpecialtyID == specialtyPlanView.SpecialtyID);
- //查询对应的年级专业信息grademajorViewList
- var grademajorViewList = SpecialtyPlanDAL.GetAdultGrademajorViewQueryable(expSchoolyear, expSpecialty).ToList();
-
- 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)).SingleOrDefault();
- if (specialtyPlan == null)
- {
- throw new Exception("数据有误,请核查。");
- }
- else
- {
- //表示修改
- specialtyPlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- specialtyPlan.StartSchoolyearID = startSchoolyear.SchoolyearID;
- specialtyPlan.SpecialtyID = specialty.SpecialtyID;
- 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)
- //注:由于相关业务主键冗余且同时存在主外键关联,目前不允许修改相关业务主键
- foreach (var grademajorView in grademajorViewList)
- {
- //判断年级专业对应的学生人数
- if (grademajorView.StudentCount <= 0)
- {
- //表示年级专业对应的学生人数小于等于0(暂不做考虑)
- }
- else
- {
- //查询对应的执行计划信息(业务主键:学年学期ID、年级专业ID、课程信息ID)
- var executablePlan = SpecialtyPlanDAL.ExecutablePlanRepository.GetList(x => x.SchoolyearID == specialtyPlanView.SchoolyearID
- && x.GrademajorID == grademajorView.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 + "-" + grademajorView.Name;
- executablePlan.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- executablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- executablePlan.GrademajorID = grademajorView.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))
- {
- //查询对应的执行计划信息View
- var newExecutablePlanView = ExecutablePlanDAL.GetExecutablePlanViewQueryable(x => x.ExecutablePlanID == newExecutablePlan.ExecutablePlanID).SingleOrDefault();
- //查询对应的专业计划信息(业务主键:学年学期ID、入学学年学期ID、专业信息ID、课程信息ID)
- var newSpecialtyPlanView = SpecialtyPlanDAL.GetAdultSpecialtyPlanViewQueryable(x => x.SpecialtyPlanID != specialtyPlan.SpecialtyPlanID
- && x.SchoolyearID == newExecutablePlanView.SchoolyearID
- && x.StartSchoolyearID == newExecutablePlanView.StartSchoolyearID
- && x.SpecialtyID == newExecutablePlanView.SpecialtyID
- && x.CoursematerialID == newExecutablePlanView.CoursematerialID).SingleOrDefault();
- if (newSpecialtyPlanView == null)
- {
- newExecutablePlan.SpecialtyPlanID = null;
- SetModifyStatus(newExecutablePlan);
- newExecutablePlanUpList.Add(newExecutablePlan);
- }
- else
- {
- //来源专业计划默认为必修课
- newExecutablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
- newExecutablePlan.DefaultClassName = newExecutablePlanView.CourseName + "-" + newExecutablePlanView.GrademajorName;
- newExecutablePlan.SpecialtyPlanID = newSpecialtyPlanView.SpecialtyPlanID;
- newExecutablePlan.SchoolyearID = newSpecialtyPlanView.SchoolyearID;
- newExecutablePlan.GrademajorID = newExecutablePlanView.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.StartSchoolyearID = startSchoolyear.SchoolyearID;
- newSpecialtyPlan.SpecialtyID = specialty.SpecialtyID;
- 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)
- //注:由于相关业务主键冗余且同时存在主外键关联,目前不允许修改相关业务主键
- foreach (var grademajorView in grademajorViewList)
- {
- //查询对应的执行计划信息(业务主键:学年学期ID、年级专业ID、课程信息ID)
- var executablePlan = SpecialtyPlanDAL.ExecutablePlanRepository.GetList(x => x.SchoolyearID == specialtyPlanView.SchoolyearID
- && x.GrademajorID == grademajorView.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 + "-" + grademajorView.Name;
- executablePlan.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
- executablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- executablePlan.GrademajorID = grademajorView.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())
- {
- //删除
- 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 AdultSpecialtyPlanBatchAdd(List<SpecialtyCourseView> specialtyCourseViewList, SpecialtyPlanView specialtyPlanView)
- {
- try
- {
- //查询对应的专业信息
- var specialty = SpecialtyPlanDAL.SpecialtyRepository
- .GetList(x => x.SpecialtyID == specialtyPlanView.SpecialtyID).SingleOrDefault();
- if (specialty == 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 == specialtyPlanView.GradeID
- && x.SchoolcodeID == specialtyPlanView.StartSchoolcodeID).SingleOrDefault();
- if (startSchoolyear == null)
- {
- throw new Exception("选择新增的入学学期、年级对应的入学学年学期不存在,请检查。");
- }
- //查询对应的毕业学年学期信息(根据入学学期、年级和专业信息对应的学制计算)
- var graduateSchoolyearValue = (specialtyPlanView.GradeID.Value * 2) - 1
- + (specialtyPlanView.StartSchoolcodeID.Value - 1);
- graduateSchoolyearValue += Convert.ToInt32(Math.Ceiling(specialty.LearnSystem.Value * 2 - 1));
- var graduatingSemester = schoolyearList.Where(x => x.Value == graduateSchoolyearValue).SingleOrDefault();
- if (graduatingSemester == null)
- {
- throw new Exception("选择新增的入学学期、年级和专业信息对应的毕业学年学期信息不存在,请检查。");
- }
- //查询专业计划信息specialtyPlanList
- var specialtyPlanList = SpecialtyPlanDAL.SpecialtyPlanRepository.GetList(x => x.SpecialtyID == specialty.SpecialtyID
- && x.StartSchoolyearID == startSchoolyear.SchoolyearID, (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、课程信息ID)
- var specialtyPlan = specialtyPlanList.Where(x => x.SchoolyearID == schoolyear.SchoolyearID
- && x.StartSchoolyearID == startSchoolyear.SchoolyearID
- && x.SpecialtyID == specialty.SpecialtyID
- && 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.StartSchoolyearID = startSchoolyear.SchoolyearID;
- newSpecialtyPlan.SpecialtyID = specialty.SpecialtyID;
- 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="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="starttermID"></param>
- /// <param name="handleModeID"></param>
- /// <param name="startSchoolcodeID"></param>
- /// <param name="yearID"></param>
- /// <param name="specialtyID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<SpecialtyCourseView> GetAdultSpecialtyCourseViewNoAddGrid(ConfiguretView configuretView, Guid? departmentID,
- int? educationID, int? learningformID, string learnSystem, Guid? coursematerialID, int? starttermID, int? handleModeID,
- int? startSchoolcodeID, int? yearID, Guid? specialtyID, int pageIndex, int pageSize)
- {
- //专业课程
- Expression<Func<EM_SpecialtyCourse, bool>> expSpecialtyCourse = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyCourse = expSpecialtyCourse.And(x => x.IsEnable == true);
- expSpecialtyCourse = expSpecialtyCourse.And(x => x.SpecialtyID == specialtyID);
- 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<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSchoolyear = expSchoolyear.And(x => x.SchoolcodeID == startSchoolcodeID);
- expSchoolyear = expSchoolyear.And(x => x.Years == yearID);
- //专业信息
- Expression<Func<CF_Specialty, bool>> expSpecialty = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialty = expSpecialty.And(x => x.SpecialtyID == specialtyID);
- if (educationID.HasValue)
- {
- expSpecialty = expSpecialty.And(x => x.EducationID == educationID);
- }
- if (learningformID.HasValue)
- {
- expSpecialty = expSpecialty.And(x => x.LearningformID == learningformID);
- }
- if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(learnSystem);
- expSpecialty = expSpecialty.And(x => x.LearnSystem == LearnSystems);
- }
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (coursematerialID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
- }
- if (specialtyID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.SpecialtyID == specialtyID);
- }
- var query = SpecialtyPlanDAL.GetAdultSpecialtyCourseViewNoAddQueryable(expSpecialtyCourse, expSchoolyear, expSpecialty, expSpecialtyPlan);
-
- //查询条件
- 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="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="starttermID"></param>
- /// <param name="handleModeID"></param>
- /// <param name="startSchoolcodeID"></param>
- /// <param name="yearID"></param>
- /// <param name="specialtyID"></param>
- /// <returns></returns>
- public IList<SpecialtyCourseView> GetAdultSpecialtyCourseViewNoAddList(ConfiguretView configuretView, Guid? departmentID,
- int? educationID, int? learningformID, string learnSystem, Guid? coursematerialID, int? starttermID, int? handleModeID,
- int? startSchoolcodeID, int? yearID, Guid? specialtyID)
- {
- //专业课程
- Expression<Func<EM_SpecialtyCourse, bool>> expSpecialtyCourse = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyCourse = expSpecialtyCourse.And(x => x.IsEnable == true);
- expSpecialtyCourse = expSpecialtyCourse.And(x => x.SpecialtyID == specialtyID);
- 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<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSchoolyear = expSchoolyear.And(x => x.SchoolcodeID == startSchoolcodeID);
- expSchoolyear = expSchoolyear.And(x => x.Years == yearID);
- //专业信息
- Expression<Func<CF_Specialty, bool>> expSpecialty = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialty = expSpecialty.And(x => x.SpecialtyID == specialtyID);
- if (educationID.HasValue)
- {
- expSpecialty = expSpecialty.And(x => x.EducationID == educationID);
- }
- if (learningformID.HasValue)
- {
- expSpecialty = expSpecialty.And(x => x.LearningformID == learningformID);
- }
- if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(learnSystem);
- expSpecialty = expSpecialty.And(x => x.LearnSystem == LearnSystems);
- }
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (coursematerialID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
- }
- if (specialtyID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.SpecialtyID == specialtyID);
- }
- var query = SpecialtyPlanDAL.GetAdultSpecialtyCourseViewNoAddQueryable(expSpecialtyCourse, expSchoolyear, expSpecialty, expSpecialtyPlan);
- //查询条件
- 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 AdultSpecialtyPlanDelete(List<Guid?> specialtyPlanIDs)
- {
- try
- {
- 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));
- ts.Complete();
- return true;
- }
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 专业计划执行
- /// 注:成教版本(入学学年学期、专业信息)
- /// 注:年级专业对应的学生人数小于等于0时,不可执行
- /// </summary>
- /// <param name="specialtyPlanIDList"></param>
- /// <returns></returns>
- public string AdultSpecialtyPlanExecute(List<Guid?> specialtyPlanIDList)
- {
- try
- {
- //查询对应的专业计划信息specialtyPlanViewList
- var specialtyPlanViewList = SpecialtyPlanDAL.GetAdultSpecialtyPlanViewQueryable(x => specialtyPlanIDList.Contains(x.SpecialtyPlanID)).ToList();
- //查询对应的入学学年学期IDList
- var startSchoolyearIDList = specialtyPlanViewList.Select(x => x.StartSchoolyearID).Distinct().ToList();
- //查询对应的专业信息IDList
- var specialtyIDList = specialtyPlanViewList.Select(x => x.SpecialtyID).Distinct().ToList();
- //学年学期
- Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSchoolyear = expSchoolyear.And(x => startSchoolyearIDList.Contains(x.SchoolyearID));
- //专业信息
- Expression<Func<CF_Specialty, bool>> expSpecialty = (x => x.RecordStatus >= (int)SYS_STATUS.UNUSABLE);
- expSpecialty = expSpecialty.And(x => specialtyIDList.Contains(x.SpecialtyID));
- //查询对应的年级专业信息grademajorViewList
- var grademajorViewList = SpecialtyPlanDAL.GetAdultGrademajorViewQueryable(expSchoolyear, expSpecialty).ToList();
- //查询对应的年级专业IDList
- var grademajorIDList = grademajorViewList.Select(x => x.GrademajorID).Distinct().ToList();
- //查询对比后的执行计划信息List(暂时只对比年级专业ID)
- var executablePlanList = SpecialtyPlanDAL.ExecutablePlanRepository
- .GetList(x => grademajorIDList.Contains(x.GrademajorID.Value), (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
- {
- //查询对应的年级专业信息List
- var newGrademajorViewList = grademajorViewList.Where(x => x.StartSchoolyearID == specialtyPlanView.StartSchoolyearID
- && x.SpecialtyID == specialtyPlanView.SpecialtyID).ToList();
- //根据业务主键查询对应的执行计划信息(业务主键:学年学期ID、年级专业ID、课程信息ID)
- //注:由于相关业务主键冗余且同时存在主外键关联,目前不允许修改相关业务主键
- foreach (var newGrademajorView in newGrademajorViewList)
- {
- //判断年级专业对应的学生人数
- if (newGrademajorView.StudentCount <= 0)
- {
- //表示年级专业对应的学生人数小于等于0
- fail++;
- }
- else
- {
- var executablePlan = executablePlanList.Where(x => x.SchoolyearID == specialtyPlanView.SchoolyearID
- && x.GrademajorID == newGrademajorView.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 + "-" + newGrademajorView.Name;
- newExecutablePlan.SpecialtyPlanID = specialtyPlanView.SpecialtyPlanID;
- newExecutablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- newExecutablePlan.GrademajorID = newGrademajorView.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 + "-" + newGrademajorView.Name;
- executablePlan.SpecialtyPlanID = specialtyPlanView.SpecialtyPlanID;
- executablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- executablePlan.GrademajorID = newGrademajorView.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))
- {
- //查询对应的执行计划信息View
- var newExecutablePlanView = ExecutablePlanDAL.GetExecutablePlanViewQueryable(x => x.ExecutablePlanID == newExecutablePlan.ExecutablePlanID).SingleOrDefault();
- //查询对应的专业计划信息(业务主键:学年学期ID、入学学年学期ID、专业信息ID、课程信息ID)
- var newSpecialtyPlanView = SpecialtyPlanDAL.GetAdultSpecialtyPlanViewQueryable(x => x.SpecialtyPlanID != specialtyPlanView.SpecialtyPlanID
- && x.SchoolyearID == newExecutablePlanView.SchoolyearID
- && x.StartSchoolyearID == newExecutablePlanView.StartSchoolyearID
- && x.SpecialtyID == newExecutablePlanView.SpecialtyID
- && x.CoursematerialID == newExecutablePlanView.CoursematerialID).SingleOrDefault();
- if (newSpecialtyPlanView == null)
- {
- newExecutablePlan.SpecialtyPlanID = null;
- SetModifyStatus(newExecutablePlan);
- newExecutablePlanUpList.Add(newExecutablePlan);
- }
- else
- {
- //来源专业计划默认为必修课
- newExecutablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
- newExecutablePlan.DefaultClassName = newExecutablePlanView.CourseName + "-" + newExecutablePlanView.GrademajorName;
- newExecutablePlan.SpecialtyPlanID = newSpecialtyPlanView.SpecialtyPlanID;
- newExecutablePlan.SchoolyearID = newSpecialtyPlanView.SchoolyearID;
- newExecutablePlan.GrademajorID = newExecutablePlanView.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 + "条,原因:年级专业对应的学生人数为0、学年学期小于入学学年学期或学年学期大于毕业学年学期,请检查";
- }
- 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>
- /// 查询对应的计划范围信息GrademajorView(根据专业计划信息,统计各年级专业对应的班级数、学生人数)
- /// 注:成教版本(入学学年学期、专业信息)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="specialtyPlanID"></param>
- /// <param name="collegeID"></param>
- /// <param name="grademajorID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<GrademajorView> GetAdultPlanRangeViewGrid(ConfiguretView configuretView, Guid? specialtyPlanID,
- Guid? collegeID, Guid? grademajorID, 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 = InSchoolSettingServices.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.GetAdultPlanRangeViewQueryable(expSpecialtyPlan, expStudent);
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (grademajorID.HasValue)
- {
- query = query.Where(x => x.GrademajorID == grademajorID);
- }
- //查询条件
- 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.Code.Length).ThenBy(x => x.Code)
- .ToGridResultSet<GrademajorView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询对应的计划范围信息List(根据专业计划信息,统计各年级专业对应的班级数、学生人数)
- /// 注:成教版本(入学学年学期、专业信息)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="specialtyPlanID"></param>
- /// <param name="collegeID"></param>
- /// <param name="grademajorID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <returns></returns>
- public IList<GrademajorView> GetAdultPlanRangeViewList(ConfiguretView configuretView, Guid? specialtyPlanID,
- Guid? collegeID, Guid? grademajorID, 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 = InSchoolSettingServices.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.GetAdultPlanRangeViewQueryable(expSpecialtyPlan, expStudent);
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (grademajorID.HasValue)
- {
- query = query.Where(x => x.GrademajorID == grademajorID);
- }
- //查询条件
- 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.Code.Length).ThenBy(x => x.Code)
- .ToList();
- }
- /// <summary>
- /// 查询专业计划对应的学生信息BaseStudentView
- /// 注:成教版本(入学学年学期、专业信息)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="specialtyPlanID"></param>
- /// <param name="collegeID"></param>
- /// <param name="classmajorID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<BaseStudentView> GetAdultBaseStudentViewGrid(ConfiguretView configuretView, Guid? specialtyPlanID,
- Guid? collegeID, 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 = InSchoolSettingServices.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.GetAdultBaseStudentViewQueryable(expSpecialtyPlan, expStudent);
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- 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.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenBy(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="collegeID"></param>
- /// <param name="classmajorID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <returns></returns>
- public IList<BaseStudentView> GetAdultBaseStudentViewList(ConfiguretView configuretView, Guid? specialtyPlanID,
- Guid? collegeID, 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 = InSchoolSettingServices.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.GetAdultBaseStudentViewQueryable(expSpecialtyPlan, expStudent);
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- 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.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenBy(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 AdultSpecialtyPlanImport(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 gradeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Grade).ToList();
- //开课学年
- var schoolyearNumList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_SchoolyearNum).ToList();
- //学期
- var schoolcodeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Semester).ToList();
- //专业代码、专业名称、专业ID(Value)
- var standardList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Standard).ToList();
- //培养层次(所修学历)
- var educationList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Education).ToList();
- //学习形式
- var learningFormList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Learningform).ToList();
- //专业信息
- var specialtyList = SpecialtyPlanDAL.SpecialtyRepository.GetList(x => true).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)
- var newSpecialtyPlanList = specialtyPlanList.Where(x => 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.GradeStr))
- {
- errCount++;
- errorMsgStr = "年级不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var grade = gradeList.Where(x => x.Name == en.GradeStr.Trim()).SingleOrDefault();
- if (grade == null)
- {
- errCount++;
- errorMsgStr = "年级不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //年级
- en.GradeID = grade.Value;
- }
- }
- //入学学期
- if (string.IsNullOrWhiteSpace(en.StartSchoolcodeStr))
- {
- errCount++;
- errorMsgStr = "入学学期不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var startSchoolcode = schoolcodeList.Where(x => x.Name == en.StartSchoolcodeStr.Trim()).SingleOrDefault();
- if (startSchoolcode == null)
- {
- errCount++;
- errorMsgStr = "入学学期不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //入学学期
- en.StartSchoolcodeID = startSchoolcode.Value;
- }
- }
- //查询对应的入学学年学期ID
- if (en.GradeID.HasValue && en.StartSchoolcodeID.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
- {
- //入学学年学期ID
- newSpecialtyPlan.StartSchoolyearID = startSchoolyear.SchoolyearID;
- //入学学年学期对应的Value值
- en.StartValue = startSchoolyear.Value;
- }
- }
- else
- {
- errCount++;
- errorMsgStr = "数据有误,请检查(年级或入学学期不能为空)";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- //专业代码
- if (string.IsNullOrWhiteSpace(en.StandardCodeStr))
- {
- errCount++;
- errorMsgStr = "专业代码不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var standard = standardList.Where(x => x.Code == en.StandardCodeStr.Trim()).FirstOrDefault();
- if (standard == null)
- {
- errCount++;
- errorMsgStr = "专业代码不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //专业代码
- }
- }
- //专业名称
- if (string.IsNullOrWhiteSpace(en.StandardNameStr))
- {
- errCount++;
- errorMsgStr = "专业名称不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var standard = standardList.Where(x => x.Name == en.StandardNameStr.Trim()).FirstOrDefault();
- if (standard == null)
- {
- errCount++;
- errorMsgStr = "专业名称不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //专业名称
- }
- }
- //专业代码与专业名称查询专业ID(Value)
- if (string.IsNullOrWhiteSpace(en.StandardCodeStr) || string.IsNullOrWhiteSpace(en.StandardNameStr))
- {
- errCount++;
- errorMsgStr = "专业代码或专业名称不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var standard = standardList.Where(x => x.Code == en.StandardCodeStr.Trim() && x.Name == en.StandardNameStr.Trim()).SingleOrDefault();
- if (standard == null)
- {
- errCount++;
- errorMsgStr = "专业代码与专业名称对应的元素值不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //专业ID(Value)
- en.StandardID = standard.Value;
- }
- }
- //培养层次
- if (string.IsNullOrWhiteSpace(en.EducationStr))
- {
- errCount++;
- errorMsgStr = RSL.Get("EducationID") + "不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var education = educationList.Where(x => x.Name == en.EducationStr.Trim()).SingleOrDefault();
- if (education == null)
- {
- errCount++;
- errorMsgStr = RSL.Get("EducationID") + "不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //培养层次
- en.EducationID = education.Value;
- }
- }
- //学习形式
- if (string.IsNullOrWhiteSpace(en.LearningformStr))
- {
- errCount++;
- errorMsgStr = "学习形式不能为空";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- var learningForm = learningFormList.Where(x => x.Name == en.LearningformStr.Trim()).SingleOrDefault();
- if (learningForm == null)
- {
- errCount++;
- errorMsgStr = "学习形式不存在,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //学习形式
- en.LearningformID = learningForm.Value;
- }
- }
- //学制
- if (string.IsNullOrWhiteSpace(en.LearnSystemStr))
- {
- 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.LearnSystemStr.Trim()))
- {
- errCount++;
- errorMsgStr = "学制格式不正确,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //学制
- en.LearnSystem = Convert.ToDecimal(en.LearnSystemStr.Trim());
- }
- }
- //查询对应的专业信息ID
- if (en.StandardID.HasValue && en.EducationID.HasValue && en.LearningformID.HasValue && en.LearnSystem.HasValue)
- {
- //查询对应的专业信息
- var specialty = specialtyList.Where(x => x.StandardID == en.StandardID
- && x.EducationID == en.EducationID
- && x.LearningformID == en.LearningformID
- && x.LearnSystem == en.LearnSystem).SingleOrDefault();
- if (specialty == null)
- {
- errCount++;
- errorMsgStr = "对应的专业信息不存在(以专业代码、专业名称、"
- + RSL.Get("EducationID") + "、学习形式、学制查询),请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- else
- {
- //判断对应的专业信息状态(启用、禁用状态)
- if (specialty.RecordStatus > (int)SYS_STATUS.UNUSABLE)
- {
- newSpecialtyPlan.SpecialtyID = specialty.SpecialtyID;
- }
- else
- {
- newSpecialtyPlan.SpecialtyID = specialty.SpecialtyID;
- errCount++;
- errorMsgStr = "对应的专业信息为禁用状态,请检查";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- }
- }
- else
- {
- errCount++;
- errorMsgStr = "数据有误,请检查(专业ID(Value)、"
- + RSL.Get("EducationID") + "、学习形式或学制不能为空)";
- en.ErrorMessage = errorMsgStr;
- errList.Add(en);
- errorMsg.AppendLine(errorMsgStr);
- continue;
- }
- //开课学年
- 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;
- }
- }
- //查询对应的学年学期ID且匹配对应的学年学期(学年学期不为空时)
- if (en.GradeID.HasValue && en.StartSchoolcodeID.HasValue && en.SchoolyearNumID.HasValue && en.SchoolcodeID.HasValue && en.LearnSystem.HasValue)
- {
- //查询对应的毕业学年学期信息
- var graduateSchoolyearValue = (en.GradeID.Value * 2) - 1 + (en.StartSchoolcodeID.Value - 1);
- graduateSchoolyearValue += Convert.ToInt32(Math.Ceiling(en.LearnSystem.Value * 2 - 1));
- var graduatingSemester = schoolyearList.Where(x => x.Value == graduateSchoolyearValue).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 < en.StartValue)
- {
- 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.SchoolyearCode))
- {
- //暂不考虑
- }
- else
- {
- //暂不考虑
- }
- //课程代码
- 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 = false;
- }
- 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、课程信息ID唯一)
- // if (en.No == enA.No && en.Name == enA.Name)
- // {
- // //用于标识Excel表中的重复记录(由于是批量进行插入数据表)
- // }
- //}
- //数据表重复性验证(学年学期ID、入学学年学期ID、专业信息ID、课程信息ID唯一)
- var specialtyPlanVerification = newSpecialtyPlanList.Where(x => x.SchoolyearID == newSpecialtyPlan.SchoolyearID
- && x.StartSchoolyearID == newSpecialtyPlan.StartSchoolyearID
- && x.SpecialtyID == newSpecialtyPlan.SpecialtyID
- && x.CoursematerialID == newSpecialtyPlan.CoursematerialID).SingleOrDefault();
- if (specialtyPlanVerification == null)
- {
- //新增
- if (!newSpecialtyPlanInList.Any(x => x.SchoolyearID == newSpecialtyPlan.SchoolyearID
- && x.StartSchoolyearID == newSpecialtyPlan.StartSchoolyearID
- && x.SpecialtyID == newSpecialtyPlan.SpecialtyID
- && 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;
- 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;
- }
- }
- }
- }
|