SpecialtyPlanServices.cs 208 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Linq.Expressions;
  7. using System.Transactions;
  8. using Bowin.Common.Utility;
  9. using Bowin.Common.Linq;
  10. using Bowin.Common.Linq.Entity;
  11. using EMIS.Utility;
  12. using EMIS.Entities;
  13. using EMIS.ViewModel;
  14. using EMIS.ViewModel.CacheManage;
  15. using EMIS.ViewModel.CultureplanManage;
  16. using EMIS.ViewModel.CultureplanManage.PlanManagement;
  17. using EMIS.ViewModel.Students;
  18. using EMIS.DataLogic.CultureplanManage.PlanManagement;
  19. using EMIS.CommonLogic.Students;
  20. using EMIS.CommonLogic.StudentManage.StudentStatistics;
  21. using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
  22. namespace EMIS.CommonLogic.CultureplanManage.PlanManagement
  23. {
  24. public class SpecialtyPlanServices : BaseServices, ISpecialtyPlanServices
  25. {
  26. public SpecialtyPlanDAL SpecialtyPlanDAL { get; set; }
  27. public Lazy<IInSchoolSettingServices> InSchoolStatusSettingServices { get; set; }
  28. /// <summary>
  29. /// 查询对应的专业计划信息SpecialtyPlanView
  30. /// 注:普教版本(年级专业)
  31. /// </summary>
  32. /// <param name="configuretView"></param>
  33. /// <param name="schoolyearID"></param>
  34. /// <param name="campusID"></param>
  35. /// <param name="collegeID"></param>
  36. /// <param name="yearID"></param>
  37. /// <param name="standardID"></param>
  38. /// <param name="educationID"></param>
  39. /// <param name="learningformID"></param>
  40. /// <param name="learnSystem"></param>
  41. /// <param name="grademajorID"></param>
  42. /// <param name="coursematerialID"></param>
  43. /// <param name="teachingModeID"></param>
  44. /// <param name="handleModeID"></param>
  45. /// <param name="pageIndex"></param>
  46. /// <param name="pageSize"></param>
  47. /// <returns></returns>
  48. public IGridResultSet<SpecialtyPlanView> GetSpecialtyPlanViewGrid(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID,
  49. Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? grademajorID,
  50. Guid? coursematerialID, int? teachingModeID, int? handleModeID, int pageIndex, int pageSize)
  51. {
  52. //专业计划
  53. Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  54. if (schoolyearID.HasValue)
  55. {
  56. expSpecialtyPlan = expSpecialtyPlan.And(x => x.SchoolyearID == schoolyearID);
  57. }
  58. if (grademajorID.HasValue)
  59. {
  60. expSpecialtyPlan = expSpecialtyPlan.And(x => x.GrademajorID == grademajorID);
  61. }
  62. if (coursematerialID.HasValue)
  63. {
  64. expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
  65. }
  66. if (handleModeID.HasValue)
  67. {
  68. expSpecialtyPlan = expSpecialtyPlan.And(x => x.HandleModeID == handleModeID);
  69. }
  70. //学生信息
  71. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  72. var query = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(expSpecialtyPlan, expStudent);
  73. if (campusID.HasValue)
  74. {
  75. query = query.Where(x => x.CampusID == campusID);
  76. }
  77. if (collegeID.HasValue)
  78. {
  79. query = query.Where(x => x.CollegeID == collegeID);
  80. }
  81. if (yearID.HasValue)
  82. {
  83. query = query.Where(x => x.GradeID == yearID);
  84. }
  85. if (standardID.HasValue)
  86. {
  87. query = query.Where(x => x.StandardID == standardID);
  88. }
  89. if (educationID.HasValue)
  90. {
  91. query = query.Where(x => x.EducationID == educationID);
  92. }
  93. if (learningformID.HasValue)
  94. {
  95. query = query.Where(x => x.LearningformID == learningformID);
  96. }
  97. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  98. {
  99. var LearnSystems = Convert.ToDecimal(learnSystem);
  100. query = query.Where(x => x.LearnSystem == LearnSystems);
  101. }
  102. if (teachingModeID.HasValue)
  103. {
  104. //授课方式
  105. query = query.Where(x => x.TeachingModeIDList.Contains(teachingModeID));
  106. }
  107. //查询条件
  108. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  109. {
  110. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  111. }
  112. return this.GetQueryByDataRangeByCollege(query)
  113. .OrderBy(x => x.GrademajorCode.Length).ThenBy(x => x.GrademajorCode)
  114. .ThenBy(x => x.Value).ThenBy(x => x.CourseTypeID)
  115. .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
  116. .ToGridResultSet<SpecialtyPlanView>(pageIndex, pageSize);
  117. }
  118. /// <summary>
  119. /// 查询对应的专业计划信息List
  120. /// 注:普教版本(年级专业)
  121. /// </summary>
  122. /// <param name="configuretView"></param>
  123. /// <param name="schoolyearID"></param>
  124. /// <param name="campusID"></param>
  125. /// <param name="collegeID"></param>
  126. /// <param name="yearID"></param>
  127. /// <param name="standardID"></param>
  128. /// <param name="educationID"></param>
  129. /// <param name="learningformID"></param>
  130. /// <param name="learnSystem"></param>
  131. /// <param name="grademajorID"></param>
  132. /// <param name="coursematerialID"></param>
  133. /// <param name="teachingModeID"></param>
  134. /// <param name="handleModeID"></param>
  135. /// <returns></returns>
  136. public IList<SpecialtyPlanView> GetSpecialtyPlanViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID,
  137. Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? grademajorID,
  138. Guid? coursematerialID, int? teachingModeID, int? handleModeID)
  139. {
  140. //专业计划
  141. Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  142. if (schoolyearID.HasValue)
  143. {
  144. expSpecialtyPlan = expSpecialtyPlan.And(x => x.SchoolyearID == schoolyearID);
  145. }
  146. if (grademajorID.HasValue)
  147. {
  148. expSpecialtyPlan = expSpecialtyPlan.And(x => x.GrademajorID == grademajorID);
  149. }
  150. if (coursematerialID.HasValue)
  151. {
  152. expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
  153. }
  154. if (handleModeID.HasValue)
  155. {
  156. expSpecialtyPlan = expSpecialtyPlan.And(x => x.HandleModeID == handleModeID);
  157. }
  158. //学生信息
  159. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  160. var query = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(expSpecialtyPlan, expStudent);
  161. if (campusID.HasValue)
  162. {
  163. query = query.Where(x => x.CampusID == campusID);
  164. }
  165. if (collegeID.HasValue)
  166. {
  167. query = query.Where(x => x.CollegeID == collegeID);
  168. }
  169. if (yearID.HasValue)
  170. {
  171. query = query.Where(x => x.GradeID == yearID);
  172. }
  173. if (standardID.HasValue)
  174. {
  175. query = query.Where(x => x.StandardID == standardID);
  176. }
  177. if (educationID.HasValue)
  178. {
  179. query = query.Where(x => x.EducationID == educationID);
  180. }
  181. if (learningformID.HasValue)
  182. {
  183. query = query.Where(x => x.LearningformID == learningformID);
  184. }
  185. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  186. {
  187. var LearnSystems = Convert.ToDecimal(learnSystem);
  188. query = query.Where(x => x.LearnSystem == LearnSystems);
  189. }
  190. if (teachingModeID.HasValue)
  191. {
  192. //授课方式
  193. query = query.Where(x => x.TeachingModeIDList.Contains(teachingModeID));
  194. }
  195. //查询条件
  196. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  197. {
  198. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  199. }
  200. return this.GetQueryByDataRangeByCollege(query)
  201. .OrderBy(x => x.GrademajorCode.Length).ThenBy(x => x.GrademajorCode)
  202. .ThenBy(x => x.Value).ThenBy(x => x.CourseTypeID)
  203. .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode).ToList();
  204. }
  205. /// <summary>
  206. /// 查询对应的专业计划信息SpecialtyPlanView(根据专业计划ID)
  207. /// </summary>
  208. /// <param name="specialtyPlanID"></param>
  209. /// <returns></returns>
  210. public SpecialtyPlanView GetSpecialtyPlanView(Guid? specialtyPlanID)
  211. {
  212. try
  213. {
  214. var specialtyPlanView = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(x => x.SpecialtyPlanID == specialtyPlanID).SingleOrDefault();
  215. return specialtyPlanView;
  216. }
  217. catch (Exception ex)
  218. {
  219. throw new Exception(ex.Message);
  220. }
  221. }
  222. /// <summary>
  223. /// 编辑(新增、修改,业务主键:学年学期ID、年级专业ID、课程信息ID)
  224. /// 注:刷新相关的执行计划信息
  225. /// </summary>
  226. /// <param name="specialtyPlanView"></param>
  227. public virtual void SpecialtyPlanEdit(SpecialtyPlanView specialtyPlanView)
  228. {
  229. try
  230. {
  231. //查询对应的年级专业信息
  232. var grademajor = SpecialtyPlanDAL.GrademajorRepository.GetList(x => x.GrademajorID == specialtyPlanView.GrademajorID).SingleOrDefault();
  233. if (grademajor == null)
  234. {
  235. throw new Exception("年级专业信息不存在,请检查。");
  236. }
  237. //查询年级专业对应的入学学年学期信息
  238. var startSchoolyear = SpecialtyPlanDAL.SchoolyearRepository.GetList(x => x.Years == grademajor.GradeID
  239. && x.SchoolcodeID == grademajor.SemesterID).SingleOrDefault();
  240. if (startSchoolyear == null)
  241. {
  242. throw new Exception("年级专业对应的入学学年学期信息不存在,请检查。");
  243. }
  244. //查询年级专业对应的毕业学年学期信息
  245. var graduatingSemester = SpecialtyPlanDAL.SchoolyearRepository
  246. .GetList(x => x.SchoolyearID == grademajor.GraduateSchoolyearID).SingleOrDefault();
  247. if (graduatingSemester == null)
  248. {
  249. throw new Exception("年级专业对应的毕业学年学期信息不存在,请检查。");
  250. }
  251. //查询对应的学年学期信息
  252. var schoolyear = SpecialtyPlanDAL.SchoolyearRepository
  253. .GetList(x => x.SchoolyearID == specialtyPlanView.SchoolyearID).SingleOrDefault();
  254. if (schoolyear == null)
  255. {
  256. throw new Exception("学年学期信息不存在,请检查。");
  257. }
  258. if (schoolyear.Value < startSchoolyear.Value)
  259. {
  260. throw new Exception("学年学期小于入学学年学期,请检查。");
  261. }
  262. if (schoolyear.Value > graduatingSemester.Value)
  263. {
  264. throw new Exception("学年学期大于毕业学年学期,请检查。");
  265. }
  266. //查询数据库进行验证
  267. var specialtyPlanVerify = SpecialtyPlanDAL.SpecialtyPlanRepository
  268. .GetList(x => x.SpecialtyPlanID != specialtyPlanView.SpecialtyPlanID
  269. && x.SchoolyearID == specialtyPlanView.SchoolyearID
  270. && x.GrademajorID == specialtyPlanView.GrademajorID
  271. && x.CoursematerialID == specialtyPlanView.CoursematerialID).SingleOrDefault();
  272. if (specialtyPlanVerify == null)
  273. {
  274. List<EM_SpecialtyPlan> newSpecialtyPlanInList = new List<EM_SpecialtyPlan>();
  275. List<EM_SpecialtyPlan> newSpecialtyPlanUpList = new List<EM_SpecialtyPlan>();
  276. List<EM_SpecialtyPlanTeachingSetting> newSPTeachingSettingInList = new List<EM_SpecialtyPlanTeachingSetting>();
  277. List<EM_SpecialtyPlanTeachingSetting> newSPTeachingSettingUpList = new List<EM_SpecialtyPlanTeachingSetting>();
  278. List<EM_SpecialtyPlanTeachingModeType> newSPTeachingModeTypeInList = new List<EM_SpecialtyPlanTeachingModeType>();
  279. List<EM_SpecialtyPlanTeachingPlace> newSPTeachingPlaceInList = new List<EM_SpecialtyPlanTeachingPlace>();
  280. List<Guid?> specialtyPlanTMDelList = new List<Guid?>();
  281. List<Guid?> specialtyPlanTPDelList = new List<Guid?>();
  282. List<EM_ExecutablePlan> newExecutablePlanUpList = new List<EM_ExecutablePlan>();
  283. List<EM_ExecutablePlanProfile> newProfileInList = new List<EM_ExecutablePlanProfile>();
  284. List<EM_ExecutablePlanProfile> newProfileUpList = new List<EM_ExecutablePlanProfile>();
  285. List<EM_ExecutablePlanTeachingSetting> newEPTeachingSettingInList = new List<EM_ExecutablePlanTeachingSetting>();
  286. List<EM_ExecutablePlanTeachingSetting> newEPTeachingSettingUpList = new List<EM_ExecutablePlanTeachingSetting>();
  287. List<EM_ExecutablePlanTeachingModeType> newEPTeachingModeTypeInList = new List<EM_ExecutablePlanTeachingModeType>();
  288. List<EM_ExecutablePlanTeachingPlace> newEPTeachingPlaceInList = new List<EM_ExecutablePlanTeachingPlace>();
  289. List<Guid?> executablePlanTMDelList = new List<Guid?>();
  290. List<Guid?> executablePlanTPDelList = new List<Guid?>();
  291. List<Guid> executablePlanIDList = new List<Guid>();
  292. //数据有误验证
  293. if (specialtyPlanView.SpecialtyPlanID != Guid.Empty)
  294. {
  295. var specialtyPlan = SpecialtyPlanDAL.SpecialtyPlanRepository
  296. .GetList(x => x.SpecialtyPlanID == specialtyPlanView.SpecialtyPlanID,
  297. (x => x.EM_SpecialtyPlanTeachingSetting), (x => x.EM_ExecutablePlan)).SingleOrDefault();
  298. if (specialtyPlan == null)
  299. {
  300. throw new Exception("数据有误,请核查。");
  301. }
  302. else
  303. {
  304. //表示修改
  305. specialtyPlan.SchoolyearID = specialtyPlanView.SchoolyearID;
  306. specialtyPlan.GrademajorID = specialtyPlanView.GrademajorID;
  307. specialtyPlan.CoursematerialID = specialtyPlanView.CoursematerialID;
  308. specialtyPlan.CourseStructureID = specialtyPlanView.CourseStructureID;
  309. specialtyPlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
  310. specialtyPlan.CourseTypeID = specialtyPlanView.CourseTypeID;
  311. specialtyPlan.CourseQualityID = specialtyPlanView.CourseQualityID;
  312. specialtyPlan.DepartmentID = specialtyPlanView.DepartmentID;
  313. specialtyPlan.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
  314. specialtyPlan.IsCooperation = specialtyPlanView.IsCooperation;
  315. specialtyPlan.IsRequired = specialtyPlanView.IsRequired;
  316. specialtyPlan.IsElective = specialtyPlanView.IsElective;
  317. specialtyPlan.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
  318. specialtyPlan.IsMainCourse = specialtyPlanView.IsMainCourse;
  319. specialtyPlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
  320. specialtyPlan.CourseFineID = specialtyPlanView.CourseFineID;
  321. specialtyPlan.PracticeTypeID = specialtyPlanView.PracticeTypeID;
  322. specialtyPlan.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
  323. specialtyPlan.ExaminationModeID = specialtyPlanView.ExaminationModeID;
  324. specialtyPlan.ResultTypeID = specialtyPlanView.ResultTypeID;
  325. specialtyPlan.HandleModeID = specialtyPlanView.HandleModeID;
  326. specialtyPlan.Remark = specialtyPlanView.Remark;
  327. SetModifyStatus(specialtyPlan);
  328. newSpecialtyPlanUpList.Add(specialtyPlan);
  329. if (specialtyPlan.EM_SpecialtyPlanTeachingSetting == null)
  330. {
  331. var newSPTeachingSetting = new EM_SpecialtyPlanTeachingSetting();
  332. newSPTeachingSetting.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
  333. newSPTeachingSetting.Credit = specialtyPlanView.Credit;
  334. newSPTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
  335. newSPTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
  336. newSPTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
  337. newSPTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
  338. newSPTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
  339. newSPTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
  340. newSPTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
  341. newSPTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
  342. newSPTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
  343. newSPTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
  344. newSPTeachingSettingInList.Add(newSPTeachingSetting);
  345. }
  346. else
  347. {
  348. specialtyPlan.EM_SpecialtyPlanTeachingSetting.Credit = specialtyPlanView.Credit;
  349. specialtyPlan.EM_SpecialtyPlanTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
  350. specialtyPlan.EM_SpecialtyPlanTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
  351. specialtyPlan.EM_SpecialtyPlanTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
  352. specialtyPlan.EM_SpecialtyPlanTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
  353. specialtyPlan.EM_SpecialtyPlanTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
  354. specialtyPlan.EM_SpecialtyPlanTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
  355. specialtyPlan.EM_SpecialtyPlanTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
  356. specialtyPlan.EM_SpecialtyPlanTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
  357. specialtyPlan.EM_SpecialtyPlanTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
  358. specialtyPlan.EM_SpecialtyPlanTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
  359. newSPTeachingSettingUpList.Add(specialtyPlan.EM_SpecialtyPlanTeachingSetting);
  360. }
  361. if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
  362. {
  363. specialtyPlanTMDelList.Add(specialtyPlan.SpecialtyPlanID);
  364. foreach (var teachingModeID in specialtyPlanView.TeachingModeIDList)
  365. {
  366. var newSPTeachingMode = new EM_SpecialtyPlanTeachingModeType();
  367. newSPTeachingMode.SpecialtyPlanTeachingModeTypeID = Guid.NewGuid();
  368. newSPTeachingMode.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
  369. newSPTeachingMode.TeachingModeID = teachingModeID;
  370. SetNewStatus(newSPTeachingMode);
  371. newSPTeachingModeTypeInList.Add(newSPTeachingMode);
  372. }
  373. }
  374. else
  375. {
  376. specialtyPlanTMDelList.Add(specialtyPlan.SpecialtyPlanID);
  377. }
  378. if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
  379. {
  380. specialtyPlanTPDelList.Add(specialtyPlan.SpecialtyPlanID);
  381. foreach (var teachingPlaceID in specialtyPlanView.TeachingPlaceIDList)
  382. {
  383. var newSPTeachingPlace = new EM_SpecialtyPlanTeachingPlace();
  384. newSPTeachingPlace.SpecialtyPlanTeachingPlaceID = Guid.NewGuid();
  385. newSPTeachingPlace.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
  386. newSPTeachingPlace.TeachingPlace = teachingPlaceID;
  387. SetNewStatus(newSPTeachingPlace);
  388. newSPTeachingPlaceInList.Add(newSPTeachingPlace);
  389. }
  390. }
  391. else
  392. {
  393. specialtyPlanTPDelList.Add(specialtyPlan.SpecialtyPlanID);
  394. }
  395. //对应的执行计划信息更新(根据业务主键:学年学期ID、年级专业ID、课程信息ID)
  396. //注:由于相关业务主键冗余且同时存在主外键关联,目前不允许修改相关业务主键
  397. var executablePlan = SpecialtyPlanDAL.ExecutablePlanRepository.GetList(x => x.SchoolyearID == specialtyPlanView.SchoolyearID
  398. && x.GrademajorID == specialtyPlanView.GrademajorID
  399. && x.CoursematerialID == specialtyPlanView.CoursematerialID,
  400. (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).SingleOrDefault();
  401. if (executablePlan == null)
  402. {
  403. //表示不存在对应的执行计划信息(暂不新增)
  404. }
  405. else
  406. {
  407. //表示存在对应的执行计划信息(修改)
  408. executablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
  409. //暂不考虑
  410. //executablePlan.DefaultClassName = specialtyPlanView.CourseName + "-" + specialtyPlanView.GrademajorName;
  411. executablePlan.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
  412. executablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
  413. executablePlan.GrademajorID = specialtyPlanView.GrademajorID;
  414. executablePlan.CoursematerialID = specialtyPlanView.CoursematerialID;
  415. executablePlan.CourseStructureID = specialtyPlanView.CourseStructureID;
  416. executablePlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
  417. executablePlan.CourseTypeID = specialtyPlanView.CourseTypeID;
  418. executablePlan.CourseQualityID = specialtyPlanView.CourseQualityID;
  419. executablePlan.DepartmentID = specialtyPlanView.DepartmentID;
  420. executablePlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
  421. executablePlan.ResultTypeID = specialtyPlanView.ResultTypeID;
  422. executablePlan.HandleModeID = specialtyPlanView.HandleModeID;
  423. SetModifyStatus(executablePlan);
  424. newExecutablePlanUpList.Add(executablePlan);
  425. if (executablePlan.EM_ExecutablePlanProfile == null)
  426. {
  427. var newProfile = new EM_ExecutablePlanProfile();
  428. newProfile.ExecutablePlanID = executablePlan.ExecutablePlanID;
  429. newProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
  430. newProfile.IsCooperation = specialtyPlanView.IsCooperation;
  431. newProfile.IsRequired = specialtyPlanView.IsRequired;
  432. newProfile.IsElective = specialtyPlanView.IsElective;
  433. newProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
  434. newProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
  435. newProfile.CourseFineID = specialtyPlanView.CourseFineID;
  436. newProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
  437. newProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
  438. newProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
  439. SetNewStatus(newProfile);
  440. newProfileInList.Add(newProfile);
  441. }
  442. else
  443. {
  444. executablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
  445. executablePlan.EM_ExecutablePlanProfile.IsCooperation = specialtyPlanView.IsCooperation;
  446. executablePlan.EM_ExecutablePlanProfile.IsRequired = specialtyPlanView.IsRequired;
  447. executablePlan.EM_ExecutablePlanProfile.IsElective = specialtyPlanView.IsElective;
  448. executablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
  449. executablePlan.EM_ExecutablePlanProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
  450. executablePlan.EM_ExecutablePlanProfile.CourseFineID = specialtyPlanView.CourseFineID;
  451. executablePlan.EM_ExecutablePlanProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
  452. executablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
  453. executablePlan.EM_ExecutablePlanProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
  454. SetModifyStatus(executablePlan.EM_ExecutablePlanProfile);
  455. newProfileUpList.Add(executablePlan.EM_ExecutablePlanProfile);
  456. }
  457. if (executablePlan.EM_ExecutablePlanTeachingSetting == null)
  458. {
  459. var newEPTeachingSetting = new EM_ExecutablePlanTeachingSetting();
  460. newEPTeachingSetting.ExecutablePlanID = executablePlan.ExecutablePlanID;
  461. newEPTeachingSetting.Credit = specialtyPlanView.Credit;
  462. newEPTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
  463. newEPTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
  464. newEPTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
  465. newEPTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
  466. newEPTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
  467. newEPTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
  468. newEPTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
  469. newEPTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
  470. newEPTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
  471. newEPTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
  472. newEPTeachingSettingInList.Add(newEPTeachingSetting);
  473. }
  474. else
  475. {
  476. //可更新的相关信息
  477. executablePlan.EM_ExecutablePlanTeachingSetting.Credit = specialtyPlanView.Credit;
  478. executablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
  479. executablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
  480. executablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
  481. if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
  482. {
  483. executablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
  484. executablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
  485. executablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
  486. executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
  487. executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
  488. executablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
  489. executablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
  490. }
  491. newEPTeachingSettingUpList.Add(executablePlan.EM_ExecutablePlanTeachingSetting);
  492. }
  493. if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
  494. {
  495. //可更新的相关信息
  496. if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
  497. {
  498. executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
  499. foreach (var newModeType in specialtyPlanView.TeachingModeIDList.ToList())
  500. {
  501. var newEPTeachingModeType = new EM_ExecutablePlanTeachingModeType();
  502. newEPTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
  503. newEPTeachingModeType.ExecutablePlanID = executablePlan.ExecutablePlanID;
  504. newEPTeachingModeType.TeachingModeID = newModeType;
  505. this.SetNewStatus(newEPTeachingModeType);
  506. newEPTeachingModeTypeInList.Add(newEPTeachingModeType);
  507. }
  508. }
  509. else
  510. {
  511. executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
  512. }
  513. }
  514. if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
  515. {
  516. executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
  517. foreach (var newPlace in specialtyPlanView.TeachingPlaceIDList.ToList())
  518. {
  519. var newEPTeachingPlace = new EM_ExecutablePlanTeachingPlace();
  520. newEPTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
  521. newEPTeachingPlace.ExecutablePlanID = executablePlan.ExecutablePlanID;
  522. newEPTeachingPlace.TeachingPlace = newPlace;
  523. this.SetNewStatus(newEPTeachingPlace);
  524. newEPTeachingPlaceInList.Add(newEPTeachingPlace);
  525. }
  526. }
  527. else
  528. {
  529. executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
  530. }
  531. executablePlanIDList.Add(executablePlan.ExecutablePlanID);
  532. }
  533. //存在对应的主外键关联
  534. if (specialtyPlan.EM_ExecutablePlan.Count() > 0)
  535. {
  536. //根据专业计划主键ID查询对应的执行计划信息List
  537. var newExecutablePlanList = SpecialtyPlanDAL.ExecutablePlanRepository
  538. .GetList(x => x.SpecialtyPlanID == specialtyPlan.SpecialtyPlanID,
  539. (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).ToList();
  540. foreach (var newExecutablePlan in newExecutablePlanList)
  541. {
  542. if (!executablePlanIDList.Contains(newExecutablePlan.ExecutablePlanID))
  543. {
  544. //查询对应的专业计划信息(业务主键:学年学期ID、年级专业ID、课程信息ID)
  545. var newSpecialtyPlanView = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(x => x.SpecialtyPlanID != specialtyPlan.SpecialtyPlanID
  546. && x.SchoolyearID == newExecutablePlan.SchoolyearID
  547. && x.GrademajorID == newExecutablePlan.GrademajorID
  548. && x.CoursematerialID == newExecutablePlan.CoursematerialID).SingleOrDefault();
  549. if (newSpecialtyPlanView == null)
  550. {
  551. newExecutablePlan.SpecialtyPlanID = null;
  552. SetModifyStatus(newExecutablePlan);
  553. newExecutablePlanUpList.Add(newExecutablePlan);
  554. }
  555. else
  556. {
  557. //来源专业计划默认为必修课
  558. newExecutablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
  559. newExecutablePlan.DefaultClassName = newSpecialtyPlanView.CourseName + "-" + newSpecialtyPlanView.GrademajorName;
  560. newExecutablePlan.SpecialtyPlanID = newSpecialtyPlanView.SpecialtyPlanID;
  561. newExecutablePlan.SchoolyearID = newSpecialtyPlanView.SchoolyearID;
  562. newExecutablePlan.GrademajorID = newSpecialtyPlanView.GrademajorID;
  563. newExecutablePlan.CoursematerialID = newSpecialtyPlanView.CoursematerialID;
  564. newExecutablePlan.CourseStructureID = newSpecialtyPlanView.CourseStructureID;
  565. newExecutablePlan.CourseCategoryID = newSpecialtyPlanView.CourseCategoryID;
  566. newExecutablePlan.CourseTypeID = newSpecialtyPlanView.CourseTypeID;
  567. newExecutablePlan.CourseQualityID = newSpecialtyPlanView.CourseQualityID;
  568. newExecutablePlan.DepartmentID = newSpecialtyPlanView.DepartmentID;
  569. newExecutablePlan.IsNeedMaterial = newSpecialtyPlanView.IsNeedMaterial;
  570. newExecutablePlan.ResultTypeID = newSpecialtyPlanView.ResultTypeID;
  571. newExecutablePlan.HandleModeID = newSpecialtyPlanView.HandleModeID;
  572. SetModifyStatus(newExecutablePlan);
  573. newExecutablePlanUpList.Add(newExecutablePlan);
  574. if (newExecutablePlan.EM_ExecutablePlanProfile == null)
  575. {
  576. var newProfile = new EM_ExecutablePlanProfile();
  577. newProfile.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
  578. newProfile.IsSpecialtycore = newSpecialtyPlanView.IsSpecialtycore;
  579. newProfile.IsCooperation = newSpecialtyPlanView.IsCooperation;
  580. newProfile.IsRequired = newSpecialtyPlanView.IsRequired;
  581. newProfile.IsElective = newSpecialtyPlanView.IsElective;
  582. newProfile.IsNetworkCourse = newSpecialtyPlanView.IsNetworkCourse;
  583. newProfile.IsMainCourse = newSpecialtyPlanView.IsMainCourse;
  584. newProfile.CourseFineID = newSpecialtyPlanView.CourseFineID;
  585. newProfile.PracticeTypeID = newSpecialtyPlanView.PracticeTypeID;
  586. newProfile.TeachinglanguageID = newSpecialtyPlanView.TeachinglanguageID;
  587. newProfile.ExaminationModeID = newSpecialtyPlanView.ExaminationModeID;
  588. SetNewStatus(newProfile);
  589. newProfileInList.Add(newProfile);
  590. }
  591. else
  592. {
  593. newExecutablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = newSpecialtyPlanView.IsSpecialtycore;
  594. newExecutablePlan.EM_ExecutablePlanProfile.IsCooperation = newSpecialtyPlanView.IsCooperation;
  595. newExecutablePlan.EM_ExecutablePlanProfile.IsRequired = newSpecialtyPlanView.IsRequired;
  596. newExecutablePlan.EM_ExecutablePlanProfile.IsElective = newSpecialtyPlanView.IsElective;
  597. newExecutablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = newSpecialtyPlanView.IsNetworkCourse;
  598. newExecutablePlan.EM_ExecutablePlanProfile.IsMainCourse = newSpecialtyPlanView.IsMainCourse;
  599. newExecutablePlan.EM_ExecutablePlanProfile.CourseFineID = newSpecialtyPlanView.CourseFineID;
  600. newExecutablePlan.EM_ExecutablePlanProfile.PracticeTypeID = newSpecialtyPlanView.PracticeTypeID;
  601. newExecutablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = newSpecialtyPlanView.TeachinglanguageID;
  602. newExecutablePlan.EM_ExecutablePlanProfile.ExaminationModeID = newSpecialtyPlanView.ExaminationModeID;
  603. SetModifyStatus(newExecutablePlan.EM_ExecutablePlanProfile);
  604. newProfileUpList.Add(newExecutablePlan.EM_ExecutablePlanProfile);
  605. }
  606. if (newExecutablePlan.EM_ExecutablePlanTeachingSetting == null)
  607. {
  608. var newEPTeachingSetting = new EM_ExecutablePlanTeachingSetting();
  609. newEPTeachingSetting.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
  610. newEPTeachingSetting.Credit = newSpecialtyPlanView.Credit;
  611. newEPTeachingSetting.TheoryCourse = newSpecialtyPlanView.TheoryCourse;
  612. newEPTeachingSetting.Practicehours = newSpecialtyPlanView.Practicehours;
  613. newEPTeachingSetting.Trialhours = newSpecialtyPlanView.Trialhours;
  614. newEPTeachingSetting.TheoryWeeklyNum = newSpecialtyPlanView.TheoryWeeklyNum;
  615. newEPTeachingSetting.PracticeWeeklyNum = newSpecialtyPlanView.PracticeWeeklyNum;
  616. newEPTeachingSetting.TrialWeeklyNum = newSpecialtyPlanView.TrialWeeklyNum;
  617. newEPTeachingSetting.WeeklyHours = newSpecialtyPlanView.WeeklyHours;
  618. newEPTeachingSetting.WeeklyNum = newSpecialtyPlanView.WeeklyNum;
  619. newEPTeachingSetting.StartWeeklyNum = newSpecialtyPlanView.StartWeeklyNum;
  620. newEPTeachingSetting.EndWeeklyNum = newSpecialtyPlanView.EndWeeklyNum;
  621. newEPTeachingSettingInList.Add(newEPTeachingSetting);
  622. }
  623. else
  624. {
  625. //可更新的相关信息
  626. newExecutablePlan.EM_ExecutablePlanTeachingSetting.Credit = newSpecialtyPlanView.Credit;
  627. newExecutablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = newSpecialtyPlanView.TheoryCourse;
  628. newExecutablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = newSpecialtyPlanView.Practicehours;
  629. newExecutablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = newSpecialtyPlanView.Trialhours;
  630. if (newExecutablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
  631. {
  632. newExecutablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = newSpecialtyPlanView.TheoryWeeklyNum;
  633. newExecutablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = newSpecialtyPlanView.PracticeWeeklyNum;
  634. newExecutablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = newSpecialtyPlanView.TrialWeeklyNum;
  635. newExecutablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = newSpecialtyPlanView.WeeklyHours;
  636. newExecutablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = newSpecialtyPlanView.WeeklyNum;
  637. newExecutablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = newSpecialtyPlanView.StartWeeklyNum;
  638. newExecutablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = newSpecialtyPlanView.EndWeeklyNum;
  639. }
  640. newEPTeachingSettingUpList.Add(newExecutablePlan.EM_ExecutablePlanTeachingSetting);
  641. }
  642. if (newExecutablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
  643. {
  644. //可更新的相关信息
  645. if (newSpecialtyPlanView.TeachingModeIDList != null && newSpecialtyPlanView.TeachingModeIDList.Count() > 0)
  646. {
  647. executablePlanTMDelList.Add(newExecutablePlan.ExecutablePlanID);
  648. foreach (var newModeType in newSpecialtyPlanView.TeachingModeIDList.ToList())
  649. {
  650. var newEPTeachingModeType = new EM_ExecutablePlanTeachingModeType();
  651. newEPTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
  652. newEPTeachingModeType.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
  653. newEPTeachingModeType.TeachingModeID = newModeType;
  654. this.SetNewStatus(newEPTeachingModeType);
  655. newEPTeachingModeTypeInList.Add(newEPTeachingModeType);
  656. }
  657. }
  658. else
  659. {
  660. executablePlanTMDelList.Add(newExecutablePlan.ExecutablePlanID);
  661. }
  662. }
  663. if (newSpecialtyPlanView.TeachingPlaceIDList != null && newSpecialtyPlanView.TeachingPlaceIDList.Count() > 0)
  664. {
  665. executablePlanTPDelList.Add(newExecutablePlan.ExecutablePlanID);
  666. foreach (var newPlace in newSpecialtyPlanView.TeachingPlaceIDList.ToList())
  667. {
  668. var newEPTeachingPlace = new EM_ExecutablePlanTeachingPlace();
  669. newEPTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
  670. newEPTeachingPlace.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
  671. newEPTeachingPlace.TeachingPlace = newPlace;
  672. this.SetNewStatus(newEPTeachingPlace);
  673. newEPTeachingPlaceInList.Add(newEPTeachingPlace);
  674. }
  675. }
  676. else
  677. {
  678. executablePlanTPDelList.Add(newExecutablePlan.ExecutablePlanID);
  679. }
  680. }
  681. executablePlanIDList.Add(newExecutablePlan.ExecutablePlanID);
  682. }
  683. }
  684. }
  685. }
  686. }
  687. else
  688. {
  689. //表示新增
  690. var newSpecialtyPlan = new EM_SpecialtyPlan();
  691. newSpecialtyPlan.SpecialtyPlanID = Guid.NewGuid();
  692. newSpecialtyPlan.PlanApplicationID = null;
  693. newSpecialtyPlan.SchoolyearID = specialtyPlanView.SchoolyearID;
  694. newSpecialtyPlan.GrademajorID = specialtyPlanView.GrademajorID;
  695. newSpecialtyPlan.CoursematerialID = specialtyPlanView.CoursematerialID;
  696. newSpecialtyPlan.CourseStructureID = specialtyPlanView.CourseStructureID;
  697. newSpecialtyPlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
  698. newSpecialtyPlan.CourseTypeID = specialtyPlanView.CourseTypeID;
  699. newSpecialtyPlan.CourseQualityID = specialtyPlanView.CourseQualityID;
  700. newSpecialtyPlan.DepartmentID = specialtyPlanView.DepartmentID;
  701. newSpecialtyPlan.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
  702. newSpecialtyPlan.IsCooperation = specialtyPlanView.IsCooperation;
  703. newSpecialtyPlan.IsRequired = specialtyPlanView.IsRequired;
  704. newSpecialtyPlan.IsElective = specialtyPlanView.IsElective;
  705. newSpecialtyPlan.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
  706. newSpecialtyPlan.IsMainCourse = specialtyPlanView.IsMainCourse;
  707. newSpecialtyPlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
  708. newSpecialtyPlan.CourseFineID = specialtyPlanView.CourseFineID;
  709. newSpecialtyPlan.PracticeTypeID = specialtyPlanView.PracticeTypeID;
  710. newSpecialtyPlan.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
  711. newSpecialtyPlan.ExaminationModeID = specialtyPlanView.ExaminationModeID;
  712. newSpecialtyPlan.ResultTypeID = specialtyPlanView.ResultTypeID;
  713. newSpecialtyPlan.HandleModeID = specialtyPlanView.HandleModeID;
  714. newSpecialtyPlan.Remark = specialtyPlanView.Remark;
  715. SetNewStatus(newSpecialtyPlan);
  716. newSpecialtyPlanInList.Add(newSpecialtyPlan);
  717. var newSPTeachingSetting = new EM_SpecialtyPlanTeachingSetting();
  718. newSPTeachingSetting.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
  719. newSPTeachingSetting.Credit = specialtyPlanView.Credit;
  720. newSPTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
  721. newSPTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
  722. newSPTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
  723. newSPTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
  724. newSPTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
  725. newSPTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
  726. newSPTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
  727. newSPTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
  728. newSPTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
  729. newSPTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
  730. newSPTeachingSettingInList.Add(newSPTeachingSetting);
  731. if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
  732. {
  733. foreach (var teachingModeID in specialtyPlanView.TeachingModeIDList)
  734. {
  735. var newSPTeachingMode = new EM_SpecialtyPlanTeachingModeType();
  736. newSPTeachingMode.SpecialtyPlanTeachingModeTypeID = Guid.NewGuid();
  737. newSPTeachingMode.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
  738. newSPTeachingMode.TeachingModeID = teachingModeID;
  739. SetNewStatus(newSPTeachingMode);
  740. newSPTeachingModeTypeInList.Add(newSPTeachingMode);
  741. }
  742. }
  743. if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
  744. {
  745. foreach (var teachingPlaceID in specialtyPlanView.TeachingPlaceIDList)
  746. {
  747. var newSPTeachingPlace = new EM_SpecialtyPlanTeachingPlace();
  748. newSPTeachingPlace.SpecialtyPlanTeachingPlaceID = Guid.NewGuid();
  749. newSPTeachingPlace.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
  750. newSPTeachingPlace.TeachingPlace = teachingPlaceID;
  751. SetNewStatus(newSPTeachingPlace);
  752. newSPTeachingPlaceInList.Add(newSPTeachingPlace);
  753. }
  754. }
  755. //对应的执行计划信息更新(根据业务主键:学年学期ID、年级专业ID、课程信息ID)
  756. //注:由于相关业务主键冗余且同时存在主外键关联,目前不允许修改相关业务主键
  757. var executablePlan = SpecialtyPlanDAL.ExecutablePlanRepository.GetList(x => x.SchoolyearID == specialtyPlanView.SchoolyearID
  758. && x.GrademajorID == specialtyPlanView.GrademajorID
  759. && x.CoursematerialID == specialtyPlanView.CoursematerialID,
  760. (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).SingleOrDefault();
  761. if (executablePlan == null)
  762. {
  763. //表示不存在对应的执行计划信息(暂不新增)
  764. }
  765. else
  766. {
  767. //表示存在对应的执行计划信息(修改)
  768. executablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
  769. //暂不考虑
  770. //executablePlan.DefaultClassName = specialtyPlanView.CourseName + "-" + specialtyPlanView.GrademajorName;
  771. executablePlan.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
  772. executablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
  773. executablePlan.GrademajorID = specialtyPlanView.GrademajorID;
  774. executablePlan.CoursematerialID = specialtyPlanView.CoursematerialID;
  775. executablePlan.CourseStructureID = specialtyPlanView.CourseStructureID;
  776. executablePlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
  777. executablePlan.CourseTypeID = specialtyPlanView.CourseTypeID;
  778. executablePlan.CourseQualityID = specialtyPlanView.CourseQualityID;
  779. executablePlan.DepartmentID = specialtyPlanView.DepartmentID;
  780. executablePlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
  781. executablePlan.ResultTypeID = specialtyPlanView.ResultTypeID;
  782. executablePlan.HandleModeID = specialtyPlanView.HandleModeID;
  783. SetModifyStatus(executablePlan);
  784. newExecutablePlanUpList.Add(executablePlan);
  785. if (executablePlan.EM_ExecutablePlanProfile == null)
  786. {
  787. var newProfile = new EM_ExecutablePlanProfile();
  788. newProfile.ExecutablePlanID = executablePlan.ExecutablePlanID;
  789. newProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
  790. newProfile.IsCooperation = specialtyPlanView.IsCooperation;
  791. newProfile.IsRequired = specialtyPlanView.IsRequired;
  792. newProfile.IsElective = specialtyPlanView.IsElective;
  793. newProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
  794. newProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
  795. newProfile.CourseFineID = specialtyPlanView.CourseFineID;
  796. newProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
  797. newProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
  798. newProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
  799. SetNewStatus(newProfile);
  800. newProfileInList.Add(newProfile);
  801. }
  802. else
  803. {
  804. executablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
  805. executablePlan.EM_ExecutablePlanProfile.IsCooperation = specialtyPlanView.IsCooperation;
  806. executablePlan.EM_ExecutablePlanProfile.IsRequired = specialtyPlanView.IsRequired;
  807. executablePlan.EM_ExecutablePlanProfile.IsElective = specialtyPlanView.IsElective;
  808. executablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
  809. executablePlan.EM_ExecutablePlanProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
  810. executablePlan.EM_ExecutablePlanProfile.CourseFineID = specialtyPlanView.CourseFineID;
  811. executablePlan.EM_ExecutablePlanProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
  812. executablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
  813. executablePlan.EM_ExecutablePlanProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
  814. SetModifyStatus(executablePlan.EM_ExecutablePlanProfile);
  815. newProfileUpList.Add(executablePlan.EM_ExecutablePlanProfile);
  816. }
  817. if (executablePlan.EM_ExecutablePlanTeachingSetting == null)
  818. {
  819. var newEPTeachingSetting = new EM_ExecutablePlanTeachingSetting();
  820. newEPTeachingSetting.ExecutablePlanID = executablePlan.ExecutablePlanID;
  821. newEPTeachingSetting.Credit = specialtyPlanView.Credit;
  822. newEPTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
  823. newEPTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
  824. newEPTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
  825. newEPTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
  826. newEPTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
  827. newEPTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
  828. newEPTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
  829. newEPTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
  830. newEPTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
  831. newEPTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
  832. newEPTeachingSettingInList.Add(newEPTeachingSetting);
  833. }
  834. else
  835. {
  836. //可更新的相关信息
  837. executablePlan.EM_ExecutablePlanTeachingSetting.Credit = specialtyPlanView.Credit;
  838. executablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
  839. executablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
  840. executablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
  841. if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
  842. {
  843. executablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
  844. executablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
  845. executablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
  846. executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
  847. executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
  848. executablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
  849. executablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
  850. }
  851. newEPTeachingSettingUpList.Add(executablePlan.EM_ExecutablePlanTeachingSetting);
  852. }
  853. if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
  854. {
  855. //可更新的相关信息
  856. if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
  857. {
  858. executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
  859. foreach (var newModeType in specialtyPlanView.TeachingModeIDList.ToList())
  860. {
  861. var newEPTeachingModeType = new EM_ExecutablePlanTeachingModeType();
  862. newEPTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
  863. newEPTeachingModeType.ExecutablePlanID = executablePlan.ExecutablePlanID;
  864. newEPTeachingModeType.TeachingModeID = newModeType;
  865. this.SetNewStatus(newEPTeachingModeType);
  866. newEPTeachingModeTypeInList.Add(newEPTeachingModeType);
  867. }
  868. }
  869. else
  870. {
  871. executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
  872. }
  873. }
  874. if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
  875. {
  876. executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
  877. foreach (var newPlace in specialtyPlanView.TeachingPlaceIDList.ToList())
  878. {
  879. var newEPTeachingPlace = new EM_ExecutablePlanTeachingPlace();
  880. newEPTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
  881. newEPTeachingPlace.ExecutablePlanID = executablePlan.ExecutablePlanID;
  882. newEPTeachingPlace.TeachingPlace = newPlace;
  883. this.SetNewStatus(newEPTeachingPlace);
  884. newEPTeachingPlaceInList.Add(newEPTeachingPlace);
  885. }
  886. }
  887. else
  888. {
  889. executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
  890. }
  891. executablePlanIDList.Add(executablePlan.ExecutablePlanID);
  892. }
  893. }
  894. //事务提交
  895. //UnitOfWork.Commit();
  896. using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew, new TransactionOptions { IsolationLevel = IsolationLevel.Serializable }))
  897. {
  898. //删除
  899. UnitOfWork.Delete<EM_SpecialtyPlanTeachingPlace>(x => specialtyPlanTPDelList.Contains(x.SpecialtyPlanID));
  900. UnitOfWork.Delete<EM_SpecialtyPlanTeachingModeType>(x => specialtyPlanTMDelList.Contains(x.SpecialtyPlanID));
  901. //批量插入
  902. UnitOfWork.BulkInsert(newSpecialtyPlanInList);
  903. UnitOfWork.BulkInsert(newSPTeachingSettingInList);
  904. UnitOfWork.BulkInsert(newSPTeachingModeTypeInList);
  905. UnitOfWork.BulkInsert(newSPTeachingPlaceInList);
  906. //批量统一提交更新
  907. if (newSpecialtyPlanUpList != null && newSpecialtyPlanUpList.Count() > 0)
  908. {
  909. UnitOfWork.BatchUpdate(newSpecialtyPlanUpList);
  910. }
  911. //批量统一提交更新
  912. if (newSPTeachingSettingUpList != null && newSPTeachingSettingUpList.Count() > 0)
  913. {
  914. UnitOfWork.BatchUpdate(newSPTeachingSettingUpList);
  915. }
  916. //删除
  917. UnitOfWork.Delete<EM_ExecutablePlanTeachingPlace>(x => executablePlanTPDelList.Contains(x.ExecutablePlanID));
  918. UnitOfWork.Delete<EM_ExecutablePlanTeachingModeType>(x => executablePlanTMDelList.Contains(x.ExecutablePlanID));
  919. //批量插入
  920. UnitOfWork.BulkInsert(newProfileInList);
  921. UnitOfWork.BulkInsert(newEPTeachingSettingInList);
  922. UnitOfWork.BulkInsert(newEPTeachingModeTypeInList);
  923. UnitOfWork.BulkInsert(newEPTeachingPlaceInList);
  924. //批量统一提交更新
  925. if (newExecutablePlanUpList != null && newExecutablePlanUpList.Count() > 0)
  926. {
  927. UnitOfWork.BatchUpdate(newExecutablePlanUpList);
  928. }
  929. //批量统一提交更新
  930. if (newProfileUpList != null && newProfileUpList.Count() > 0)
  931. {
  932. UnitOfWork.BatchUpdate(newProfileUpList);
  933. }
  934. //批量统一提交更新
  935. if (newEPTeachingSettingUpList != null && newEPTeachingSettingUpList.Count() > 0)
  936. {
  937. UnitOfWork.BatchUpdate(newEPTeachingSettingUpList);
  938. }
  939. ts.Complete();
  940. }
  941. }
  942. else
  943. {
  944. throw new Exception("已存在相同的专业计划信息(学年学期、年级专业、课程信息唯一),请核查。");
  945. }
  946. }
  947. catch (Exception ex)
  948. {
  949. throw new Exception(ex.Message);
  950. }
  951. }
  952. /// <summary>
  953. /// 专业课程模版批量新增
  954. /// </summary>
  955. /// <param name="specialtyCourseViewList"></param>
  956. /// <param name="specialtyPlanView"></param>
  957. /// <returns></returns>
  958. public string SpecialtyPlanBatchAdd(List<SpecialtyCourseView> specialtyCourseViewList, SpecialtyPlanView specialtyPlanView)
  959. {
  960. try
  961. {
  962. //查询对应的年级专业信息
  963. var grademajor = SpecialtyPlanDAL.GrademajorRepository.GetList(x => x.GrademajorID == specialtyPlanView.GrademajorID).SingleOrDefault();
  964. if (grademajor == null)
  965. {
  966. throw new Exception("选择新增的年级专业不存在,请检查。");
  967. }
  968. //查询学年学期信息schoolyearList
  969. var schoolyearList = SpecialtyPlanDAL.SchoolyearRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  970. //查询年级专业对应的入学学年学期信息
  971. var startSchoolyear = schoolyearList.Where(x => x.Years == grademajor.GradeID && x.SchoolcodeID == grademajor.SemesterID).SingleOrDefault();
  972. if (startSchoolyear == null)
  973. {
  974. throw new Exception("选择新增的年级专业对应的入学学年学期不存在,请检查。");
  975. }
  976. //查询年级专业对应的毕业学年学期信息
  977. var graduatingSemester = schoolyearList.Where(x => x.SchoolyearID == grademajor.GraduateSchoolyearID).SingleOrDefault();
  978. if (graduatingSemester == null)
  979. {
  980. throw new Exception("选择新增的年级专业对应的毕业学年学期信息不存在,请检查。");
  981. }
  982. //查询专业计划信息specialtyPlanList
  983. var specialtyPlanList = SpecialtyPlanDAL.SpecialtyPlanRepository.GetList(x => x.GrademajorID == grademajor.GrademajorID, (x => x.EM_SpecialtyPlanTeachingSetting)).ToList();
  984. int success = 0; //成功
  985. int fail = 0; //失败
  986. string tipMessage = null; //提示消息
  987. List<EM_SpecialtyPlan> newSpecialtyPlanInList = new List<EM_SpecialtyPlan>();
  988. List<EM_SpecialtyPlanTeachingSetting> newTeachingSettingInList = new List<EM_SpecialtyPlanTeachingSetting>();
  989. List<EM_SpecialtyPlanTeachingModeType> newTeachingModeTypeInList = new List<EM_SpecialtyPlanTeachingModeType>();
  990. List<EM_SpecialtyPlanTeachingPlace> newTeachingPlaceInList = new List<EM_SpecialtyPlanTeachingPlace>();
  991. foreach (var specialtyCourseView in specialtyCourseViewList)
  992. {
  993. //判断对应的学年学期信息
  994. var value = startSchoolyear.Value + specialtyCourseView.StarttermID - 1;
  995. if (value < startSchoolyear.Value)
  996. {
  997. //表示学年学期小于入学学年学期
  998. fail++;
  999. }
  1000. else
  1001. {
  1002. if (value > graduatingSemester.Value)
  1003. {
  1004. //表示学年学期大于毕业学年学期
  1005. fail++;
  1006. }
  1007. else
  1008. {
  1009. var schoolyear = schoolyearList.Where(x => x.Value == value).SingleOrDefault();
  1010. if (schoolyear == null)
  1011. {
  1012. //表示对应的学年学期信息不存在
  1013. fail++;
  1014. }
  1015. else
  1016. {
  1017. //查询对应的专业计划信息(根据业务主键:学年学期ID、年级专业ID、课程信息ID)
  1018. var specialtyPlan = specialtyPlanList.Where(x => x.SchoolyearID == schoolyear.SchoolyearID
  1019. && x.GrademajorID == grademajor.GrademajorID
  1020. && x.CoursematerialID == specialtyCourseView.CoursematerialID).SingleOrDefault();
  1021. if (specialtyPlan == null)
  1022. {
  1023. //表示新增
  1024. var newSpecialtyPlan = new EM_SpecialtyPlan();
  1025. newSpecialtyPlan.SpecialtyPlanID = Guid.NewGuid();
  1026. newSpecialtyPlan.PlanApplicationID = null;
  1027. newSpecialtyPlan.SchoolyearID = schoolyear.SchoolyearID;
  1028. newSpecialtyPlan.GrademajorID = grademajor.GrademajorID;
  1029. newSpecialtyPlan.CoursematerialID = specialtyCourseView.CoursematerialID;
  1030. newSpecialtyPlan.CourseStructureID = specialtyCourseView.CourseStructureID;
  1031. newSpecialtyPlan.CourseCategoryID = specialtyCourseView.CourseCategoryID;
  1032. newSpecialtyPlan.CourseTypeID = specialtyCourseView.CourseTypeID;
  1033. newSpecialtyPlan.CourseQualityID = specialtyCourseView.CourseQualityID;
  1034. newSpecialtyPlan.DepartmentID = specialtyCourseView.DepartmentID;
  1035. newSpecialtyPlan.IsSpecialtycore = specialtyCourseView.IsSpecialtycore;
  1036. newSpecialtyPlan.IsCooperation = specialtyCourseView.IsCooperation;
  1037. newSpecialtyPlan.IsRequired = specialtyCourseView.IsRequired;
  1038. newSpecialtyPlan.IsElective = specialtyCourseView.IsElective;
  1039. newSpecialtyPlan.IsNetworkCourse = specialtyCourseView.IsNetworkCourse;
  1040. newSpecialtyPlan.IsMainCourse = specialtyCourseView.IsMainCourse;
  1041. newSpecialtyPlan.IsNeedMaterial = specialtyCourseView.IsNeedMaterial;
  1042. newSpecialtyPlan.CourseFineID = specialtyCourseView.CourseFineID;
  1043. newSpecialtyPlan.PracticeTypeID = specialtyCourseView.PracticeTypeID;
  1044. newSpecialtyPlan.TeachinglanguageID = specialtyCourseView.TeachinglanguageID;
  1045. newSpecialtyPlan.ExaminationModeID = specialtyCourseView.ExaminationModeID;
  1046. newSpecialtyPlan.ResultTypeID = specialtyCourseView.ResultTypeID;
  1047. newSpecialtyPlan.HandleModeID = specialtyCourseView.HandleModeID;
  1048. newSpecialtyPlan.Remark = specialtyPlanView.Remark;
  1049. SetNewStatus(newSpecialtyPlan);
  1050. newSpecialtyPlanInList.Add(newSpecialtyPlan);
  1051. var newTeachingSetting = new EM_SpecialtyPlanTeachingSetting();
  1052. newTeachingSetting.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
  1053. newTeachingSetting.Credit = specialtyCourseView.Credit;
  1054. newTeachingSetting.TheoryCourse = specialtyCourseView.TheoryCourse;
  1055. newTeachingSetting.Practicehours = specialtyCourseView.Practicehours;
  1056. newTeachingSetting.Trialhours = specialtyCourseView.Trialhours;
  1057. newTeachingSetting.TheoryWeeklyNum = specialtyCourseView.TheoryWeeklyNum;
  1058. newTeachingSetting.PracticeWeeklyNum = specialtyCourseView.PracticeWeeklyNum;
  1059. newTeachingSetting.TrialWeeklyNum = specialtyCourseView.TrialWeeklyNum;
  1060. newTeachingSetting.WeeklyHours = specialtyCourseView.WeeklyHours;
  1061. newTeachingSetting.WeeklyNum = specialtyCourseView.WeeklyNum;
  1062. newTeachingSetting.StartWeeklyNum = specialtyCourseView.StartWeeklyNum;
  1063. newTeachingSetting.EndWeeklyNum = specialtyCourseView.EndWeeklyNum;
  1064. newTeachingSettingInList.Add(newTeachingSetting);
  1065. if (specialtyCourseView.TeachingModeIDList != null && specialtyCourseView.TeachingModeIDList.Count() > 0)
  1066. {
  1067. foreach (var teachingModeID in specialtyCourseView.TeachingModeIDList)
  1068. {
  1069. var newTeachingMode = new EM_SpecialtyPlanTeachingModeType();
  1070. newTeachingMode.SpecialtyPlanTeachingModeTypeID = Guid.NewGuid();
  1071. newTeachingMode.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
  1072. newTeachingMode.TeachingModeID = teachingModeID;
  1073. SetNewStatus(newTeachingMode);
  1074. newTeachingModeTypeInList.Add(newTeachingMode);
  1075. }
  1076. }
  1077. if (specialtyCourseView.TeachingPlaceIDList != null && specialtyCourseView.TeachingPlaceIDList.Count() > 0)
  1078. {
  1079. foreach (var teachingPlaceID in specialtyCourseView.TeachingPlaceIDList)
  1080. {
  1081. var newTeachingPlace = new EM_SpecialtyPlanTeachingPlace();
  1082. newTeachingPlace.SpecialtyPlanTeachingPlaceID = Guid.NewGuid();
  1083. newTeachingPlace.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
  1084. newTeachingPlace.TeachingPlace = teachingPlaceID;
  1085. SetNewStatus(newTeachingPlace);
  1086. newTeachingPlaceInList.Add(newTeachingPlace);
  1087. }
  1088. }
  1089. success++;
  1090. }
  1091. else
  1092. {
  1093. //表示已存在相同的计划申请信息
  1094. fail++;
  1095. }
  1096. }
  1097. }
  1098. }
  1099. }
  1100. //事务提交
  1101. using (TransactionScope ts = new TransactionScope())
  1102. {
  1103. //批量插入
  1104. UnitOfWork.BulkInsert(newSpecialtyPlanInList);
  1105. UnitOfWork.BulkInsert(newTeachingSettingInList);
  1106. UnitOfWork.BulkInsert(newTeachingModeTypeInList);
  1107. UnitOfWork.BulkInsert(newTeachingPlaceInList);
  1108. ts.Complete();
  1109. }
  1110. if (success > 0 && fail <= 0)
  1111. {
  1112. tipMessage = success + "条";
  1113. }
  1114. else
  1115. {
  1116. tipMessage = success + "条,失败" + fail + "条,原因:学年学期小于入学学年学期、学年学期大于毕业学年学期、对应的学年学期不存在或已存在相同的专业计划信息,请检查";
  1117. }
  1118. return tipMessage;
  1119. }
  1120. catch (Exception ex)
  1121. {
  1122. throw new Exception(ex.Message);
  1123. }
  1124. }
  1125. /// <summary>
  1126. /// 查询对应的未新增专业课程信息SpecialtyCourseView
  1127. /// </summary>
  1128. /// <param name="configuretView"></param>
  1129. /// <param name="departmentID"></param>
  1130. /// <param name="standardID"></param>
  1131. /// <param name="educationID"></param>
  1132. /// <param name="learningformID"></param>
  1133. /// <param name="learnSystem"></param>
  1134. /// <param name="coursematerialID"></param>
  1135. /// <param name="starttermID"></param>
  1136. /// <param name="handleModeID"></param>
  1137. /// <param name="yearID"></param>
  1138. /// <param name="grademajorID"></param>
  1139. /// <param name="pageIndex"></param>
  1140. /// <param name="pageSize"></param>
  1141. /// <returns></returns>
  1142. public IGridResultSet<SpecialtyCourseView> GetSpecialtyCourseViewNoAddGrid(ConfiguretView configuretView, Guid? departmentID,
  1143. int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? coursematerialID, int? starttermID,
  1144. int? handleModeID, int? yearID, Guid? grademajorID, int pageIndex, int pageSize)
  1145. {
  1146. //专业课程
  1147. Expression<Func<EM_SpecialtyCourse, bool>> expSpecialtyCourse = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1148. expSpecialtyCourse = expSpecialtyCourse.And(x => x.IsEnable == true);
  1149. if (departmentID.HasValue)
  1150. {
  1151. expSpecialtyCourse = expSpecialtyCourse.And(x => x.DepartmentID == departmentID);
  1152. }
  1153. if (coursematerialID.HasValue)
  1154. {
  1155. expSpecialtyCourse = expSpecialtyCourse.And(x => x.CoursematerialID == coursematerialID);
  1156. }
  1157. if (starttermID.HasValue)
  1158. {
  1159. expSpecialtyCourse = expSpecialtyCourse.And(x => x.StarttermID == starttermID);
  1160. }
  1161. if (handleModeID.HasValue)
  1162. {
  1163. expSpecialtyCourse = expSpecialtyCourse.And(x => x.HandleModeID == handleModeID);
  1164. }
  1165. //年级专业
  1166. Expression<Func<CF_Grademajor, bool>> expGrademajor = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1167. if (yearID.HasValue)
  1168. {
  1169. expGrademajor = expGrademajor.And(x => x.GradeID == yearID);
  1170. }
  1171. expGrademajor = expGrademajor.And(x => x.GrademajorID == grademajorID);
  1172. //专业计划
  1173. Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1174. if (coursematerialID.HasValue)
  1175. {
  1176. expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
  1177. }
  1178. if (grademajorID.HasValue)
  1179. {
  1180. expSpecialtyPlan = expSpecialtyPlan.And(x => x.GrademajorID == grademajorID);
  1181. }
  1182. var query = SpecialtyPlanDAL.GetSpecialtyCourseViewNoAddQueryable(expSpecialtyCourse, expGrademajor, expSpecialtyPlan);
  1183. if (standardID.HasValue)
  1184. {
  1185. query = query.Where(x => x.StandardID == standardID);
  1186. }
  1187. if (educationID.HasValue)
  1188. {
  1189. query = query.Where(x => x.EducationID == educationID);
  1190. }
  1191. if (learningformID.HasValue)
  1192. {
  1193. query = query.Where(x => x.LearningformID == learningformID);
  1194. }
  1195. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  1196. {
  1197. var LearnSystems = Convert.ToDecimal(learnSystem);
  1198. query = query.Where(x => x.LearnSystem == LearnSystems);
  1199. }
  1200. //查询条件
  1201. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  1202. {
  1203. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  1204. }
  1205. return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.StandardID).ThenBy(x => x.EducationID)
  1206. .ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem)
  1207. .ThenBy(x => x.StarttermID).ThenBy(x => x.CourseTypeID)
  1208. .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
  1209. .ToGridResultSet<SpecialtyCourseView>(pageIndex, pageSize);
  1210. }
  1211. /// <summary>
  1212. /// 查询对应的未新增专业课程信息List
  1213. /// </summary>
  1214. /// <param name="configuretView"></param>
  1215. /// <param name="departmentID"></param>
  1216. /// <param name="standardID"></param>
  1217. /// <param name="educationID"></param>
  1218. /// <param name="learningformID"></param>
  1219. /// <param name="learnSystem"></param>
  1220. /// <param name="coursematerialID"></param>
  1221. /// <param name="starttermID"></param>
  1222. /// <param name="handleModeID"></param>
  1223. /// <param name="yearID"></param>
  1224. /// <param name="grademajorID"></param>
  1225. /// <returns></returns>
  1226. public IList<SpecialtyCourseView> GetSpecialtyCourseViewNoAddList(ConfiguretView configuretView, Guid? departmentID,
  1227. int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? coursematerialID, int? starttermID,
  1228. int? handleModeID, int? yearID, Guid? grademajorID)
  1229. {
  1230. //专业课程
  1231. Expression<Func<EM_SpecialtyCourse, bool>> expSpecialtyCourse = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1232. expSpecialtyCourse = expSpecialtyCourse.And(x => x.IsEnable == true);
  1233. if (departmentID.HasValue)
  1234. {
  1235. expSpecialtyCourse = expSpecialtyCourse.And(x => x.DepartmentID == departmentID);
  1236. }
  1237. if (coursematerialID.HasValue)
  1238. {
  1239. expSpecialtyCourse = expSpecialtyCourse.And(x => x.CoursematerialID == coursematerialID);
  1240. }
  1241. if (starttermID.HasValue)
  1242. {
  1243. expSpecialtyCourse = expSpecialtyCourse.And(x => x.StarttermID == starttermID);
  1244. }
  1245. if (handleModeID.HasValue)
  1246. {
  1247. expSpecialtyCourse = expSpecialtyCourse.And(x => x.HandleModeID == handleModeID);
  1248. }
  1249. //年级专业
  1250. Expression<Func<CF_Grademajor, bool>> expGrademajor = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1251. if (yearID.HasValue)
  1252. {
  1253. expGrademajor = expGrademajor.And(x => x.GradeID == yearID);
  1254. }
  1255. expGrademajor = expGrademajor.And(x => x.GrademajorID == grademajorID);
  1256. //专业计划
  1257. Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1258. if (coursematerialID.HasValue)
  1259. {
  1260. expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
  1261. }
  1262. if (grademajorID.HasValue)
  1263. {
  1264. expSpecialtyPlan = expSpecialtyPlan.And(x => x.GrademajorID == grademajorID);
  1265. }
  1266. var query = SpecialtyPlanDAL.GetSpecialtyCourseViewNoAddQueryable(expSpecialtyCourse, expGrademajor, expSpecialtyPlan);
  1267. if (standardID.HasValue)
  1268. {
  1269. query = query.Where(x => x.StandardID == standardID);
  1270. }
  1271. if (educationID.HasValue)
  1272. {
  1273. query = query.Where(x => x.EducationID == educationID);
  1274. }
  1275. if (learningformID.HasValue)
  1276. {
  1277. query = query.Where(x => x.LearningformID == learningformID);
  1278. }
  1279. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  1280. {
  1281. var LearnSystems = Convert.ToDecimal(learnSystem);
  1282. query = query.Where(x => x.LearnSystem == LearnSystems);
  1283. }
  1284. //查询条件
  1285. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  1286. {
  1287. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  1288. }
  1289. return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.StandardID).ThenBy(x => x.EducationID)
  1290. .ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem)
  1291. .ThenBy(x => x.StarttermID).ThenBy(x => x.CourseTypeID)
  1292. .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode).ToList();
  1293. }
  1294. /// <summary>
  1295. /// 删除
  1296. /// </summary>
  1297. /// <param name="specialtyPlanIDs"></param>
  1298. /// <returns></returns>
  1299. public bool SpecialtyPlanDelete(List<Guid?> specialtyPlanIDs)
  1300. {
  1301. try
  1302. {
  1303. //查询对应的专业计划信息List
  1304. var specialtyPlanList = SpecialtyPlanDAL.SpecialtyPlanRepository.GetList(x => specialtyPlanIDs.Contains(x.SpecialtyPlanID)).ToList();
  1305. //查询对应的计划申请IDList
  1306. var planApplicationIDList = specialtyPlanList.Select(x => x.PlanApplicationID).ToList();
  1307. using (TransactionScope ts = new TransactionScope())
  1308. {
  1309. UnitOfWork.Delete<EM_SpecialtyPlanTeachingPlace>(x => specialtyPlanIDs.Contains(x.SpecialtyPlanID));
  1310. UnitOfWork.Delete<EM_SpecialtyPlanTeachingModeType>(x => specialtyPlanIDs.Contains(x.SpecialtyPlanID));
  1311. UnitOfWork.Delete<EM_SpecialtyPlanTeachingSetting>(x => specialtyPlanIDs.Contains(x.SpecialtyPlanID));
  1312. UnitOfWork.Delete<EM_SpecialtyPlan>(x => specialtyPlanIDs.Contains(x.SpecialtyPlanID));
  1313. //同时删除对应的计划申请信息
  1314. UnitOfWork.Delete<EM_PlanApplicationTeachingPlace>(x => planApplicationIDList.Contains(x.PlanApplicationID));
  1315. UnitOfWork.Delete<EM_PlanApplicationTeachingModeType>(x => planApplicationIDList.Contains(x.PlanApplicationID));
  1316. UnitOfWork.Delete<EM_PlanApplicationTeachingSetting>(x => planApplicationIDList.Contains(x.PlanApplicationID));
  1317. UnitOfWork.Delete<EM_PlanApplication>(x => planApplicationIDList.Contains(x.PlanApplicationID));
  1318. ts.Complete();
  1319. return true;
  1320. }
  1321. }
  1322. catch (Exception)
  1323. {
  1324. throw;
  1325. }
  1326. }
  1327. /// <summary>
  1328. /// 专业计划执行
  1329. /// 注:普教版本(年级专业)
  1330. /// </summary>
  1331. /// <param name="specialtyPlanIDList"></param>
  1332. /// <returns></returns>
  1333. public string SpecialtyPlanExecute(List<Guid?> specialtyPlanIDList)
  1334. {
  1335. try
  1336. {
  1337. //查询对应的专业计划信息specialtyPlanViewList
  1338. var specialtyPlanViewList = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(x => specialtyPlanIDList.Contains(x.SpecialtyPlanID)).ToList();
  1339. //查询对应的年级专业IDList
  1340. var grademajorIDList = specialtyPlanViewList.Select(x => x.GrademajorID).ToList();
  1341. //查询对比后的执行计划信息List(暂时只对比年级专业ID)
  1342. var executablePlanList = SpecialtyPlanDAL.ExecutablePlanRepository
  1343. .GetList(x => grademajorIDList.Contains(x.GrademajorID), (x => x.EM_ExecutablePlanProfile),
  1344. (x => x.EM_ExecutablePlanTeachingSetting)).ToList();
  1345. int insert = 0; //成功
  1346. int update = 0; //更新
  1347. int fail = 0; //失败
  1348. string tipMessage = null; //提示消息
  1349. List<EM_ExecutablePlan> newExecutablePlanInList = new List<EM_ExecutablePlan>();
  1350. List<EM_ExecutablePlan> newExecutablePlanUpList = new List<EM_ExecutablePlan>();
  1351. List<EM_ExecutablePlanProfile> newProfileInList = new List<EM_ExecutablePlanProfile>();
  1352. List<EM_ExecutablePlanProfile> newProfileUpList = new List<EM_ExecutablePlanProfile>();
  1353. List<EM_ExecutablePlanTeachingSetting> newTeachingSettingInList = new List<EM_ExecutablePlanTeachingSetting>();
  1354. List<EM_ExecutablePlanTeachingSetting> newTeachingSettingUpList = new List<EM_ExecutablePlanTeachingSetting>();
  1355. List<EM_ExecutablePlanTeachingModeType> newTeachingModeTypeInList = new List<EM_ExecutablePlanTeachingModeType>();
  1356. List<EM_ExecutablePlanTeachingPlace> newTeachingPlaceInList = new List<EM_ExecutablePlanTeachingPlace>();
  1357. List<Guid?> executablePlanTMDelList = new List<Guid?>();
  1358. List<Guid?> executablePlanTPDelList = new List<Guid?>();
  1359. List<Guid> executablePlanIDList = new List<Guid>();
  1360. foreach (var specialtyPlanView in specialtyPlanViewList)
  1361. {
  1362. if (specialtyPlanView.Value < specialtyPlanView.StartValue)
  1363. {
  1364. //表示学年学期小于入学学年学期
  1365. fail++;
  1366. }
  1367. else
  1368. {
  1369. if (specialtyPlanView.Value > specialtyPlanView.GraduatingSemesterValue)
  1370. {
  1371. //表示学年学期大于毕业学年学期
  1372. fail++;
  1373. }
  1374. else
  1375. {
  1376. //根据业务主键查询对应的执行计划信息(业务主键:学年学期ID、年级专业ID、课程信息ID)
  1377. //注:由于相关业务主键冗余且同时存在主外键关联,目前不允许修改相关业务主键
  1378. var executablePlan = executablePlanList.Where(x => x.SchoolyearID == specialtyPlanView.SchoolyearID
  1379. && x.GrademajorID == specialtyPlanView.GrademajorID
  1380. && x.CoursematerialID == specialtyPlanView.CoursematerialID).SingleOrDefault();
  1381. if (executablePlan == null)
  1382. {
  1383. //表示不存在对应的执行计划信息(新增)
  1384. var newExecutablePlan = new EM_ExecutablePlan();
  1385. newExecutablePlan.ExecutablePlanID = Guid.NewGuid();
  1386. //来源专业计划默认为必修课
  1387. newExecutablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
  1388. newExecutablePlan.DefaultClassName = specialtyPlanView.CourseName + "-" + specialtyPlanView.GrademajorName;
  1389. newExecutablePlan.SpecialtyPlanID = specialtyPlanView.SpecialtyPlanID;
  1390. newExecutablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
  1391. newExecutablePlan.GrademajorID = specialtyPlanView.GrademajorID;
  1392. newExecutablePlan.CoursematerialID = specialtyPlanView.CoursematerialID;
  1393. newExecutablePlan.CourseStructureID = specialtyPlanView.CourseStructureID;
  1394. newExecutablePlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
  1395. newExecutablePlan.CourseTypeID = specialtyPlanView.CourseTypeID;
  1396. newExecutablePlan.CourseQualityID = specialtyPlanView.CourseQualityID;
  1397. newExecutablePlan.DepartmentID = specialtyPlanView.DepartmentID;
  1398. newExecutablePlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
  1399. newExecutablePlan.ResultTypeID = specialtyPlanView.ResultTypeID;
  1400. newExecutablePlan.HandleModeID = specialtyPlanView.HandleModeID;
  1401. newExecutablePlan.Remark = specialtyPlanView.Remark;
  1402. SetNewStatus(newExecutablePlan, (int)EM_ExecuteStatus.NotSubmited);
  1403. newExecutablePlanInList.Add(newExecutablePlan);
  1404. var newProfile = new EM_ExecutablePlanProfile();
  1405. newProfile.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
  1406. newProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
  1407. newProfile.IsCooperation = specialtyPlanView.IsCooperation;
  1408. newProfile.IsRequired = specialtyPlanView.IsRequired;
  1409. newProfile.IsElective = specialtyPlanView.IsElective;
  1410. newProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
  1411. newProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
  1412. newProfile.CourseFineID = specialtyPlanView.CourseFineID;
  1413. newProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
  1414. newProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
  1415. newProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
  1416. SetNewStatus(newProfile);
  1417. newProfileInList.Add(newProfile);
  1418. var newTeachingSetting = new EM_ExecutablePlanTeachingSetting();
  1419. newTeachingSetting.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
  1420. newTeachingSetting.Credit = specialtyPlanView.Credit;
  1421. newTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
  1422. newTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
  1423. newTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
  1424. newTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
  1425. newTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
  1426. newTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
  1427. newTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
  1428. newTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
  1429. newTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
  1430. newTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
  1431. newTeachingSettingInList.Add(newTeachingSetting);
  1432. if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
  1433. {
  1434. foreach (var newModeType in specialtyPlanView.TeachingModeIDList.ToList())
  1435. {
  1436. var newTeachingModeType = new EM_ExecutablePlanTeachingModeType();
  1437. newTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
  1438. newTeachingModeType.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
  1439. newTeachingModeType.TeachingModeID = newModeType;
  1440. this.SetNewStatus(newTeachingModeType);
  1441. newTeachingModeTypeInList.Add(newTeachingModeType);
  1442. }
  1443. }
  1444. if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
  1445. {
  1446. foreach (var newPlace in specialtyPlanView.TeachingPlaceIDList.ToList())
  1447. {
  1448. var newTeachingPlace = new EM_ExecutablePlanTeachingPlace();
  1449. newTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
  1450. newTeachingPlace.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
  1451. newTeachingPlace.TeachingPlace = newPlace;
  1452. this.SetNewStatus(newTeachingPlace);
  1453. newTeachingPlaceInList.Add(newTeachingPlace);
  1454. }
  1455. }
  1456. insert++;
  1457. }
  1458. else
  1459. {
  1460. if (!executablePlanIDList.Contains(executablePlan.ExecutablePlanID))
  1461. {
  1462. //表示存在对应的执行计划信息(修改)
  1463. executablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
  1464. executablePlan.DefaultClassName = specialtyPlanView.CourseName + "-" + specialtyPlanView.GrademajorName;
  1465. executablePlan.SpecialtyPlanID = specialtyPlanView.SpecialtyPlanID;
  1466. executablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
  1467. executablePlan.GrademajorID = specialtyPlanView.GrademajorID;
  1468. executablePlan.CoursematerialID = specialtyPlanView.CoursematerialID;
  1469. executablePlan.CourseStructureID = specialtyPlanView.CourseStructureID;
  1470. executablePlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
  1471. executablePlan.CourseTypeID = specialtyPlanView.CourseTypeID;
  1472. executablePlan.CourseQualityID = specialtyPlanView.CourseQualityID;
  1473. executablePlan.DepartmentID = specialtyPlanView.DepartmentID;
  1474. executablePlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
  1475. executablePlan.ResultTypeID = specialtyPlanView.ResultTypeID;
  1476. executablePlan.HandleModeID = specialtyPlanView.HandleModeID;
  1477. SetModifyStatus(executablePlan);
  1478. newExecutablePlanUpList.Add(executablePlan);
  1479. if (executablePlan.EM_ExecutablePlanProfile == null)
  1480. {
  1481. var newProfile = new EM_ExecutablePlanProfile();
  1482. newProfile.ExecutablePlanID = executablePlan.ExecutablePlanID;
  1483. newProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
  1484. newProfile.IsCooperation = specialtyPlanView.IsCooperation;
  1485. newProfile.IsRequired = specialtyPlanView.IsRequired;
  1486. newProfile.IsElective = specialtyPlanView.IsElective;
  1487. newProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
  1488. newProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
  1489. newProfile.CourseFineID = specialtyPlanView.CourseFineID;
  1490. newProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
  1491. newProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
  1492. newProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
  1493. SetNewStatus(newProfile);
  1494. newProfileInList.Add(newProfile);
  1495. }
  1496. else
  1497. {
  1498. executablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
  1499. executablePlan.EM_ExecutablePlanProfile.IsCooperation = specialtyPlanView.IsCooperation;
  1500. executablePlan.EM_ExecutablePlanProfile.IsRequired = specialtyPlanView.IsRequired;
  1501. executablePlan.EM_ExecutablePlanProfile.IsElective = specialtyPlanView.IsElective;
  1502. executablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
  1503. executablePlan.EM_ExecutablePlanProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
  1504. executablePlan.EM_ExecutablePlanProfile.CourseFineID = specialtyPlanView.CourseFineID;
  1505. executablePlan.EM_ExecutablePlanProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
  1506. executablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
  1507. executablePlan.EM_ExecutablePlanProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
  1508. SetModifyStatus(executablePlan.EM_ExecutablePlanProfile);
  1509. newProfileUpList.Add(executablePlan.EM_ExecutablePlanProfile);
  1510. }
  1511. if (executablePlan.EM_ExecutablePlanTeachingSetting == null)
  1512. {
  1513. var newTeachingSetting = new EM_ExecutablePlanTeachingSetting();
  1514. newTeachingSetting.ExecutablePlanID = executablePlan.ExecutablePlanID;
  1515. newTeachingSetting.Credit = specialtyPlanView.Credit;
  1516. newTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
  1517. newTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
  1518. newTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
  1519. newTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
  1520. newTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
  1521. newTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
  1522. newTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
  1523. newTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
  1524. newTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
  1525. newTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
  1526. newTeachingSettingInList.Add(newTeachingSetting);
  1527. }
  1528. else
  1529. {
  1530. //可更新的相关信息
  1531. executablePlan.EM_ExecutablePlanTeachingSetting.Credit = specialtyPlanView.Credit;
  1532. executablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
  1533. executablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
  1534. executablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
  1535. if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
  1536. {
  1537. executablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
  1538. executablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
  1539. executablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
  1540. executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
  1541. executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
  1542. executablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
  1543. executablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
  1544. }
  1545. newTeachingSettingUpList.Add(executablePlan.EM_ExecutablePlanTeachingSetting);
  1546. }
  1547. if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
  1548. {
  1549. //可更新的相关信息
  1550. if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
  1551. {
  1552. executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
  1553. foreach (var newModeType in specialtyPlanView.TeachingModeIDList.ToList())
  1554. {
  1555. var newTeachingModeType = new EM_ExecutablePlanTeachingModeType();
  1556. newTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
  1557. newTeachingModeType.ExecutablePlanID = executablePlan.ExecutablePlanID;
  1558. newTeachingModeType.TeachingModeID = newModeType;
  1559. this.SetNewStatus(newTeachingModeType);
  1560. newTeachingModeTypeInList.Add(newTeachingModeType);
  1561. }
  1562. }
  1563. else
  1564. {
  1565. executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
  1566. }
  1567. }
  1568. if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
  1569. {
  1570. executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
  1571. foreach (var newPlace in specialtyPlanView.TeachingPlaceIDList.ToList())
  1572. {
  1573. var newTeachingPlace = new EM_ExecutablePlanTeachingPlace();
  1574. newTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
  1575. newTeachingPlace.ExecutablePlanID = executablePlan.ExecutablePlanID;
  1576. newTeachingPlace.TeachingPlace = newPlace;
  1577. this.SetNewStatus(newTeachingPlace);
  1578. newTeachingPlaceInList.Add(newTeachingPlace);
  1579. }
  1580. }
  1581. else
  1582. {
  1583. executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
  1584. }
  1585. executablePlanIDList.Add(executablePlan.ExecutablePlanID);
  1586. }
  1587. update++;
  1588. }
  1589. //表示存在对应的主外键关联
  1590. if (specialtyPlanView.PlanStatus == (int)EM_PlanStatus.Execute)
  1591. {
  1592. //根据专业计划主键ID查询对应的执行计划信息List
  1593. var newExecutablePlanList = SpecialtyPlanDAL.ExecutablePlanRepository
  1594. .GetList(x => x.SpecialtyPlanID == specialtyPlanView.SpecialtyPlanID,
  1595. (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).ToList();
  1596. foreach (var newExecutablePlan in newExecutablePlanList)
  1597. {
  1598. if (!executablePlanIDList.Contains(newExecutablePlan.ExecutablePlanID))
  1599. {
  1600. //查询对应的专业计划信息(业务主键:学年学期ID、年级专业ID、课程信息ID)
  1601. var newSpecialtyPlanView = SpecialtyPlanDAL.GetSpecialtyPlanViewQueryable(x => x.SpecialtyPlanID != specialtyPlanView.SpecialtyPlanID
  1602. && x.SchoolyearID == newExecutablePlan.SchoolyearID
  1603. && x.GrademajorID == newExecutablePlan.GrademajorID
  1604. && x.CoursematerialID == newExecutablePlan.CoursematerialID).SingleOrDefault();
  1605. if (newSpecialtyPlanView == null)
  1606. {
  1607. newExecutablePlan.SpecialtyPlanID = null;
  1608. SetModifyStatus(newExecutablePlan);
  1609. newExecutablePlanUpList.Add(newExecutablePlan);
  1610. }
  1611. else
  1612. {
  1613. //来源专业计划默认为必修课
  1614. newExecutablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
  1615. newExecutablePlan.DefaultClassName = newSpecialtyPlanView.CourseName + "-" + newSpecialtyPlanView.GrademajorName;
  1616. newExecutablePlan.SpecialtyPlanID = newSpecialtyPlanView.SpecialtyPlanID;
  1617. newExecutablePlan.SchoolyearID = newSpecialtyPlanView.SchoolyearID;
  1618. newExecutablePlan.GrademajorID = newSpecialtyPlanView.GrademajorID;
  1619. newExecutablePlan.CoursematerialID = newSpecialtyPlanView.CoursematerialID;
  1620. newExecutablePlan.CourseStructureID = newSpecialtyPlanView.CourseStructureID;
  1621. newExecutablePlan.CourseCategoryID = newSpecialtyPlanView.CourseCategoryID;
  1622. newExecutablePlan.CourseTypeID = newSpecialtyPlanView.CourseTypeID;
  1623. newExecutablePlan.CourseQualityID = newSpecialtyPlanView.CourseQualityID;
  1624. newExecutablePlan.DepartmentID = newSpecialtyPlanView.DepartmentID;
  1625. newExecutablePlan.IsNeedMaterial = newSpecialtyPlanView.IsNeedMaterial;
  1626. newExecutablePlan.ResultTypeID = newSpecialtyPlanView.ResultTypeID;
  1627. newExecutablePlan.HandleModeID = newSpecialtyPlanView.HandleModeID;
  1628. SetModifyStatus(newExecutablePlan);
  1629. newExecutablePlanUpList.Add(newExecutablePlan);
  1630. if (newExecutablePlan.EM_ExecutablePlanProfile == null)
  1631. {
  1632. var newProfile = new EM_ExecutablePlanProfile();
  1633. newProfile.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
  1634. newProfile.IsSpecialtycore = newSpecialtyPlanView.IsSpecialtycore;
  1635. newProfile.IsCooperation = newSpecialtyPlanView.IsCooperation;
  1636. newProfile.IsRequired = newSpecialtyPlanView.IsRequired;
  1637. newProfile.IsElective = newSpecialtyPlanView.IsElective;
  1638. newProfile.IsNetworkCourse = newSpecialtyPlanView.IsNetworkCourse;
  1639. newProfile.IsMainCourse = newSpecialtyPlanView.IsMainCourse;
  1640. newProfile.CourseFineID = newSpecialtyPlanView.CourseFineID;
  1641. newProfile.PracticeTypeID = newSpecialtyPlanView.PracticeTypeID;
  1642. newProfile.TeachinglanguageID = newSpecialtyPlanView.TeachinglanguageID;
  1643. newProfile.ExaminationModeID = newSpecialtyPlanView.ExaminationModeID;
  1644. SetNewStatus(newProfile);
  1645. newProfileInList.Add(newProfile);
  1646. }
  1647. else
  1648. {
  1649. newExecutablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = newSpecialtyPlanView.IsSpecialtycore;
  1650. newExecutablePlan.EM_ExecutablePlanProfile.IsCooperation = newSpecialtyPlanView.IsCooperation;
  1651. newExecutablePlan.EM_ExecutablePlanProfile.IsRequired = newSpecialtyPlanView.IsRequired;
  1652. newExecutablePlan.EM_ExecutablePlanProfile.IsElective = newSpecialtyPlanView.IsElective;
  1653. newExecutablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = newSpecialtyPlanView.IsNetworkCourse;
  1654. newExecutablePlan.EM_ExecutablePlanProfile.IsMainCourse = newSpecialtyPlanView.IsMainCourse;
  1655. newExecutablePlan.EM_ExecutablePlanProfile.CourseFineID = newSpecialtyPlanView.CourseFineID;
  1656. newExecutablePlan.EM_ExecutablePlanProfile.PracticeTypeID = newSpecialtyPlanView.PracticeTypeID;
  1657. newExecutablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = newSpecialtyPlanView.TeachinglanguageID;
  1658. newExecutablePlan.EM_ExecutablePlanProfile.ExaminationModeID = newSpecialtyPlanView.ExaminationModeID;
  1659. SetModifyStatus(newExecutablePlan.EM_ExecutablePlanProfile);
  1660. newProfileUpList.Add(newExecutablePlan.EM_ExecutablePlanProfile);
  1661. }
  1662. if (newExecutablePlan.EM_ExecutablePlanTeachingSetting == null)
  1663. {
  1664. var newTeachingSetting = new EM_ExecutablePlanTeachingSetting();
  1665. newTeachingSetting.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
  1666. newTeachingSetting.Credit = newSpecialtyPlanView.Credit;
  1667. newTeachingSetting.TheoryCourse = newSpecialtyPlanView.TheoryCourse;
  1668. newTeachingSetting.Practicehours = newSpecialtyPlanView.Practicehours;
  1669. newTeachingSetting.Trialhours = newSpecialtyPlanView.Trialhours;
  1670. newTeachingSetting.TheoryWeeklyNum = newSpecialtyPlanView.TheoryWeeklyNum;
  1671. newTeachingSetting.PracticeWeeklyNum = newSpecialtyPlanView.PracticeWeeklyNum;
  1672. newTeachingSetting.TrialWeeklyNum = newSpecialtyPlanView.TrialWeeklyNum;
  1673. newTeachingSetting.WeeklyHours = newSpecialtyPlanView.WeeklyHours;
  1674. newTeachingSetting.WeeklyNum = newSpecialtyPlanView.WeeklyNum;
  1675. newTeachingSetting.StartWeeklyNum = newSpecialtyPlanView.StartWeeklyNum;
  1676. newTeachingSetting.EndWeeklyNum = newSpecialtyPlanView.EndWeeklyNum;
  1677. newTeachingSettingInList.Add(newTeachingSetting);
  1678. }
  1679. else
  1680. {
  1681. //可更新的相关信息
  1682. newExecutablePlan.EM_ExecutablePlanTeachingSetting.Credit = newSpecialtyPlanView.Credit;
  1683. newExecutablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = newSpecialtyPlanView.TheoryCourse;
  1684. newExecutablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = newSpecialtyPlanView.Practicehours;
  1685. newExecutablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = newSpecialtyPlanView.Trialhours;
  1686. if (newExecutablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
  1687. {
  1688. newExecutablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = newSpecialtyPlanView.TheoryWeeklyNum;
  1689. newExecutablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = newSpecialtyPlanView.PracticeWeeklyNum;
  1690. newExecutablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = newSpecialtyPlanView.TrialWeeklyNum;
  1691. newExecutablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = newSpecialtyPlanView.WeeklyHours;
  1692. newExecutablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = newSpecialtyPlanView.WeeklyNum;
  1693. newExecutablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = newSpecialtyPlanView.StartWeeklyNum;
  1694. newExecutablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = newSpecialtyPlanView.EndWeeklyNum;
  1695. }
  1696. newTeachingSettingUpList.Add(newExecutablePlan.EM_ExecutablePlanTeachingSetting);
  1697. }
  1698. if (newExecutablePlan.RecordStatus == (int)EM_ExecuteStatus.NotSubmited)
  1699. {
  1700. //可更新的相关信息
  1701. if (newSpecialtyPlanView.TeachingModeIDList != null && newSpecialtyPlanView.TeachingModeIDList.Count() > 0)
  1702. {
  1703. executablePlanTMDelList.Add(newExecutablePlan.ExecutablePlanID);
  1704. foreach (var newModeType in newSpecialtyPlanView.TeachingModeIDList.ToList())
  1705. {
  1706. var newTeachingModeType = new EM_ExecutablePlanTeachingModeType();
  1707. newTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
  1708. newTeachingModeType.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
  1709. newTeachingModeType.TeachingModeID = newModeType;
  1710. this.SetNewStatus(newTeachingModeType);
  1711. newTeachingModeTypeInList.Add(newTeachingModeType);
  1712. }
  1713. }
  1714. else
  1715. {
  1716. executablePlanTMDelList.Add(newExecutablePlan.ExecutablePlanID);
  1717. }
  1718. }
  1719. if (newSpecialtyPlanView.TeachingPlaceIDList != null && newSpecialtyPlanView.TeachingPlaceIDList.Count() > 0)
  1720. {
  1721. executablePlanTPDelList.Add(newExecutablePlan.ExecutablePlanID);
  1722. foreach (var newPlace in newSpecialtyPlanView.TeachingPlaceIDList.ToList())
  1723. {
  1724. var newTeachingPlace = new EM_ExecutablePlanTeachingPlace();
  1725. newTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
  1726. newTeachingPlace.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
  1727. newTeachingPlace.TeachingPlace = newPlace;
  1728. this.SetNewStatus(newTeachingPlace);
  1729. newTeachingPlaceInList.Add(newTeachingPlace);
  1730. }
  1731. }
  1732. else
  1733. {
  1734. executablePlanTPDelList.Add(newExecutablePlan.ExecutablePlanID);
  1735. }
  1736. }
  1737. executablePlanIDList.Add(newExecutablePlan.ExecutablePlanID);
  1738. }
  1739. }
  1740. }
  1741. }
  1742. }
  1743. }
  1744. using (TransactionScope ts = new TransactionScope())
  1745. {
  1746. //删除
  1747. UnitOfWork.Delete<EM_ExecutablePlanTeachingPlace>(x => executablePlanTPDelList.Contains(x.ExecutablePlanID));
  1748. UnitOfWork.Delete<EM_ExecutablePlanTeachingModeType>(x => executablePlanTMDelList.Contains(x.ExecutablePlanID));
  1749. //批量插入
  1750. UnitOfWork.BulkInsert(newExecutablePlanInList);
  1751. UnitOfWork.BulkInsert(newProfileInList);
  1752. UnitOfWork.BulkInsert(newTeachingSettingInList);
  1753. UnitOfWork.BulkInsert(newTeachingModeTypeInList);
  1754. UnitOfWork.BulkInsert(newTeachingPlaceInList);
  1755. //批量统一提交更新
  1756. if (newExecutablePlanUpList != null && newExecutablePlanUpList.Count() > 0)
  1757. {
  1758. UnitOfWork.BatchUpdate(newExecutablePlanUpList);
  1759. }
  1760. //批量统一提交更新
  1761. if (newProfileUpList != null && newProfileUpList.Count() > 0)
  1762. {
  1763. UnitOfWork.BatchUpdate(newProfileUpList);
  1764. }
  1765. //批量统一提交更新
  1766. if (newTeachingSettingUpList != null && newTeachingSettingUpList.Count() > 0)
  1767. {
  1768. UnitOfWork.BatchUpdate(newTeachingSettingUpList);
  1769. }
  1770. ts.Complete();
  1771. }
  1772. if (fail > 0)
  1773. {
  1774. tipMessage = insert + "条,刷新成功" + update + "条,失败" + fail + "条,原因:学年学期小于入学学年学期或学年学期大于毕业学年学期,请检查";
  1775. }
  1776. else if (insert > 0 && update <= 0)
  1777. {
  1778. tipMessage = insert + "条";
  1779. }
  1780. else
  1781. {
  1782. tipMessage = insert + "条,刷新成功" + update + "条";
  1783. }
  1784. return tipMessage;
  1785. }
  1786. catch (Exception)
  1787. {
  1788. throw;
  1789. }
  1790. }
  1791. /// <summary>
  1792. /// 查询专业计划对应的授课方式List
  1793. /// </summary>
  1794. /// <param name="specialtyPlanID"></param>
  1795. /// <returns></returns>
  1796. public List<string> GetTeachingModeTypeList(Guid? specialtyPlanID)
  1797. {
  1798. //专业计划
  1799. Expression<Func<EM_SpecialtyPlan, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1800. exp = exp.And(x => x.SpecialtyPlanID == specialtyPlanID);
  1801. var query = SpecialtyPlanDAL.GetTeachingModeTypeQueryble(exp);
  1802. return query.OrderBy(x => x.Value).Select(x => x.ToString()).ToList();
  1803. }
  1804. /// <summary>
  1805. /// 查询专业计划对应的授课地点List
  1806. /// </summary>
  1807. /// <param name="specialtyPlanID"></param>
  1808. /// <returns></returns>
  1809. public List<string> GetTeachingPlaceList(Guid? specialtyPlanID)
  1810. {
  1811. //专业计划
  1812. Expression<Func<EM_SpecialtyPlan, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1813. exp = exp.And(x => x.SpecialtyPlanID == specialtyPlanID);
  1814. var query = SpecialtyPlanDAL.GetTeachingPlaceQueryble(exp);
  1815. return query.OrderBy(x => x.Value).Select(x => x.ToString()).ToList();
  1816. }
  1817. /// <summary>
  1818. /// 查询专业计划对应的计划范围信息ClassmajorView
  1819. /// 注:注:普教版本(年级专业)
  1820. /// </summary>
  1821. /// <param name="configuretView"></param>
  1822. /// <param name="specialtyPlanID"></param>
  1823. /// <param name="classmajorID"></param>
  1824. /// <param name="inSchoolStatus"></param>
  1825. /// <param name="pageIndex"></param>
  1826. /// <param name="pageSize"></param>
  1827. /// <returns></returns>
  1828. public IGridResultSet<ClassmajorView> GetPlanRangeViewGrid(ConfiguretView configuretView, Guid? specialtyPlanID,
  1829. Guid? classmajorID, int? inSchoolStatus, int pageIndex, int pageSize)
  1830. {
  1831. //专业计划
  1832. Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1833. expSpecialtyPlan = expSpecialtyPlan.And(x => x.SpecialtyPlanID == specialtyPlanID);
  1834. //学生信息
  1835. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1836. if (inSchoolStatus != null && inSchoolStatus > -1)
  1837. {
  1838. var inschoolStatusList = InSchoolStatusSettingServices.Value.GetInschoolStatusList(true);
  1839. if (inSchoolStatus == 1)
  1840. {
  1841. //表示在校
  1842. expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
  1843. }
  1844. if (inSchoolStatus == 0)
  1845. {
  1846. //不在校
  1847. expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
  1848. }
  1849. }
  1850. var query = SpecialtyPlanDAL.GetPlanRangeViewQueryable(expSpecialtyPlan, expStudent);
  1851. if (classmajorID.HasValue)
  1852. {
  1853. query = query.Where(x => x.ClassmajorID == classmajorID);
  1854. }
  1855. //查询条件
  1856. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  1857. {
  1858. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  1859. }
  1860. return query.OrderBy(x => x.CollegeCode.Length)
  1861. .ThenBy(x => x.CollegeCode).ThenBy(x => x.StandardID)
  1862. .ThenBy(x => x.No.Length).ThenBy(x => x.No)
  1863. .ThenBy(x => x.ClassNum)
  1864. .ToGridResultSet<ClassmajorView>(pageIndex, pageSize);
  1865. }
  1866. /// <summary>
  1867. /// 查询专业计划对应的计划范围信息List
  1868. /// 注:注:普教版本(年级专业)
  1869. /// </summary>
  1870. /// <param name="configuretView"></param>
  1871. /// <param name="specialtyPlanID"></param>
  1872. /// <param name="classmajorID"></param>
  1873. /// <param name="inSchoolStatus"></param>
  1874. /// <returns></returns>
  1875. public IList<ClassmajorView> GetPlanRangeViewList(ConfiguretView configuretView, Guid? specialtyPlanID,
  1876. Guid? classmajorID, int? inSchoolStatus)
  1877. {
  1878. //专业计划
  1879. Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1880. expSpecialtyPlan = expSpecialtyPlan.And(x => x.SpecialtyPlanID == specialtyPlanID);
  1881. //学生信息
  1882. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1883. if (inSchoolStatus != null && inSchoolStatus > -1)
  1884. {
  1885. var inschoolStatusList = InSchoolStatusSettingServices.Value.GetInschoolStatusList(true);
  1886. if (inSchoolStatus == 1)
  1887. {
  1888. //表示在校
  1889. expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
  1890. }
  1891. if (inSchoolStatus == 0)
  1892. {
  1893. //不在校
  1894. expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
  1895. }
  1896. }
  1897. var query = SpecialtyPlanDAL.GetPlanRangeViewQueryable(expSpecialtyPlan, expStudent);
  1898. if (classmajorID.HasValue)
  1899. {
  1900. query = query.Where(x => x.ClassmajorID == classmajorID);
  1901. }
  1902. //查询条件
  1903. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  1904. {
  1905. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  1906. }
  1907. return query.OrderBy(x => x.CollegeCode.Length)
  1908. .ThenBy(x => x.CollegeCode).ThenBy(x => x.StandardID)
  1909. .ThenBy(x => x.No.Length).ThenBy(x => x.No)
  1910. .ThenBy(x => x.ClassNum).ToList();
  1911. }
  1912. /// <summary>
  1913. /// 查询专业计划对应的学生信息BaseStudentView
  1914. /// 注:普教版本(年级专业)
  1915. /// </summary>
  1916. /// <param name="configuretView"></param>
  1917. /// <param name="specialtyPlanID"></param>
  1918. /// <param name="classmajorID"></param>
  1919. /// <param name="inSchoolStatus"></param>
  1920. /// <param name="pageIndex"></param>
  1921. /// <param name="pageSize"></param>
  1922. /// <returns></returns>
  1923. public IGridResultSet<BaseStudentView> GetBaseStudentViewGrid(ConfiguretView configuretView, Guid? specialtyPlanID,
  1924. Guid? classmajorID, int? inSchoolStatus, int pageIndex, int pageSize)
  1925. {
  1926. //专业计划
  1927. Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1928. expSpecialtyPlan = expSpecialtyPlan.And(x => x.SpecialtyPlanID == specialtyPlanID);
  1929. //学生信息
  1930. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1931. if (inSchoolStatus != null && inSchoolStatus > -1)
  1932. {
  1933. var inschoolStatusList = InSchoolStatusSettingServices.Value.GetInschoolStatusList(true);
  1934. if (inSchoolStatus == 1)
  1935. {
  1936. //表示在校
  1937. expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
  1938. }
  1939. if (inSchoolStatus == 0)
  1940. {
  1941. //不在校
  1942. expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
  1943. }
  1944. }
  1945. var query = SpecialtyPlanDAL.GetBaseStudentViewQueryable(expSpecialtyPlan, expStudent);
  1946. if (classmajorID.HasValue)
  1947. {
  1948. query = query.Where(x => x.ClassmajorID == classmajorID);
  1949. }
  1950. //查询条件
  1951. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  1952. {
  1953. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  1954. }
  1955. return query.OrderBy(x => x.ClassmajorCode.Length)
  1956. .ThenBy(x => x.ClassmajorCode).ThenBy(x => x.LoginID)
  1957. .ToGridResultSet<BaseStudentView>(pageIndex, pageSize);
  1958. }
  1959. /// <summary>
  1960. /// 查询专业计划对应的学生信息List
  1961. /// 注:普教版本(年级专业)
  1962. /// </summary>
  1963. /// <param name="configuretView"></param>
  1964. /// <param name="specialtyPlanID"></param>
  1965. /// <param name="classmajorID"></param>
  1966. /// <param name="inSchoolStatus"></param>
  1967. /// <returns></returns>
  1968. public IList<BaseStudentView> GetBaseStudentViewList(ConfiguretView configuretView, Guid? specialtyPlanID,
  1969. Guid? classmajorID, int? inSchoolStatus)
  1970. {
  1971. //专业计划
  1972. Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1973. expSpecialtyPlan = expSpecialtyPlan.And(x => x.SpecialtyPlanID == specialtyPlanID);
  1974. //学生信息
  1975. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  1976. if (inSchoolStatus != null && inSchoolStatus > -1)
  1977. {
  1978. var inschoolStatusList = InSchoolStatusSettingServices.Value.GetInschoolStatusList(true);
  1979. if (inSchoolStatus == 1)
  1980. {
  1981. //表示在校
  1982. expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
  1983. }
  1984. if (inSchoolStatus == 0)
  1985. {
  1986. //不在校
  1987. expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
  1988. }
  1989. }
  1990. var query = SpecialtyPlanDAL.GetBaseStudentViewQueryable(expSpecialtyPlan, expStudent);
  1991. if (classmajorID.HasValue)
  1992. {
  1993. query = query.Where(x => x.ClassmajorID == classmajorID);
  1994. }
  1995. //查询条件
  1996. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  1997. {
  1998. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  1999. }
  2000. return query.OrderBy(x => x.ClassmajorCode.Length)
  2001. .ThenBy(x => x.ClassmajorCode).ThenBy(x => x.LoginID)
  2002. .ToList();
  2003. }
  2004. /// <summary>
  2005. /// 新增(数据库表,用于报表)
  2006. /// </summary>
  2007. /// <param name="tempTableName"></param>
  2008. /// <param name="ids"></param>
  2009. public void CreateIDTempTable(string tempTableName, List<Guid?> ids)
  2010. {
  2011. try
  2012. {
  2013. UnitOfWork.CreateIDTempTable(tempTableName, ids);
  2014. }
  2015. catch (Exception)
  2016. {
  2017. throw;
  2018. }
  2019. }
  2020. /// <summary>
  2021. /// 删除(数据库表,用于报表)
  2022. /// </summary>
  2023. /// <param name="tempTableName"></param>
  2024. /// <returns></returns>
  2025. public bool DeleteTempTable(string tempTableName)
  2026. {
  2027. try
  2028. {
  2029. UnitOfWork.DeleteTempTable(tempTableName);
  2030. return true;
  2031. }
  2032. catch (Exception)
  2033. {
  2034. throw;
  2035. }
  2036. }
  2037. /// <summary>
  2038. /// 专业计划信息Excel导入
  2039. /// 注:年级专业
  2040. /// </summary>
  2041. /// <param name="cellheader"></param>
  2042. /// <param name="inCount"></param>
  2043. /// <param name="upCount"></param>
  2044. /// <param name="errdataList"></param>
  2045. /// <param name="errCount"></param>
  2046. /// <param name="sourcePhysicalPath"></param>
  2047. public void SpecialtyPlanImport(Dictionary<string, string> cellheader, out int? inCount, out int? upCount, out List<SpecialtyPlanView> errdataList, out int? errCount, string sourcePhysicalPath)
  2048. {
  2049. try
  2050. {
  2051. StringBuilder errorMsg = new StringBuilder(); // 错误信息
  2052. List<SpecialtyPlanView> errList = new List<SpecialtyPlanView>();
  2053. // 1.1解析文件,存放到一个List集合里
  2054. cellheader.Remove("ErrorMessage");//移除“未导入原因”列(ErrorMessage)
  2055. List<SpecialtyPlanView> enlist = NpoiExcelHelper.ExcelToEntityList<SpecialtyPlanView>(cellheader, sourcePhysicalPath, out errorMsg, out errList);
  2056. cellheader.Add("ErrorMessage", "未导入原因");
  2057. //对List集合进行有效性校验
  2058. if (enlist.Count() <= 0)
  2059. {
  2060. throw new Exception("Excel文件数据为空,请检查。");
  2061. }
  2062. Regex reg = null; //正则表达式
  2063. //DateTime result; //用于返回判断日期字段格式
  2064. bool isListPass = true; //List判断标识
  2065. inCount = 0; //导入个数
  2066. upCount = 0; //更新个数
  2067. errCount = 0; //失败个数
  2068. string errorMsgStr = ""; //错误信息
  2069. List<EM_SpecialtyPlan> newSpecialtyPlanInList = new List<EM_SpecialtyPlan>();
  2070. List<EM_SpecialtyPlan> newSpecialtyPlanUpList = new List<EM_SpecialtyPlan>();
  2071. List<EM_SpecialtyPlanTeachingSetting> newTeachingSettingInList = new List<EM_SpecialtyPlanTeachingSetting>();
  2072. List<EM_SpecialtyPlanTeachingSetting> newTeachingSettingUpList = new List<EM_SpecialtyPlanTeachingSetting>();
  2073. List<EM_SpecialtyPlanTeachingModeType> newTeachingModeTypeInList = new List<EM_SpecialtyPlanTeachingModeType>();
  2074. List<EM_SpecialtyPlanTeachingPlace> newTeachingPlaceInList = new List<EM_SpecialtyPlanTeachingPlace>();
  2075. List<Guid?> specialtyPlanTMDelList = new List<Guid?>();
  2076. List<Guid?> specialtyPlanTPDelList = new List<Guid?>();
  2077. //将循环中相关数据库查询统一查询出来进行匹配(尽量避免在循环中进行数据库查询)
  2078. //年级专业信息
  2079. var grademajorList = SpecialtyPlanDAL.GrademajorRepository.GetList(x => true).ToList();
  2080. //年级专业名称
  2081. var grademajorNameList = enlist.Where(x => !string.IsNullOrEmpty(x.GrademajorName)).Select(x => x.GrademajorName.Trim()).ToList();
  2082. //对比后的newGrademajorList
  2083. var newGrademajorList = grademajorList.Where(x => grademajorNameList.Contains(x.Name)).ToList();
  2084. //对比后的grademajorIDList
  2085. var grademajorIDList = newGrademajorList.Select(x => (Guid?)x.GrademajorID).ToList();
  2086. //开课学年
  2087. var schoolyearNumList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_SchoolyearNum).ToList();
  2088. //学期
  2089. var schoolcodeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Semester).ToList();
  2090. //学年学期
  2091. var schoolyearList = SpecialtyPlanDAL.SchoolyearRepository.GetList(x => true).ToList();
  2092. //课程信息
  2093. var courseList = SpecialtyPlanDAL.CoursematerialRepository.GetList(x => true).ToList();
  2094. //课程代码
  2095. var courseCodeList = enlist.Where(x => !string.IsNullOrEmpty(x.CourseCode)).Select(x => x.CourseCode.Trim()).ToList();
  2096. //对比后的newCourseList
  2097. var newCourseList = courseList.Where(x => courseCodeList.Contains(x.CourseCode)).ToList();
  2098. //对比后的coursematerialIDList
  2099. var coursematerialIDList = newCourseList.Select(x => (Guid?)x.CoursematerialID).ToList();
  2100. //课程结构
  2101. var courseStructureList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseStructure).ToList();
  2102. //课程属性
  2103. var courseCategoryList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseCategory).ToList();
  2104. //课程类型
  2105. var courseTypeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseType).ToList();
  2106. //课程性质
  2107. var courseQualityList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseQuality).ToList();
  2108. //教研室信息
  2109. var departmentList = SpecialtyPlanDAL.DepartmentRepository.GetList(x => true).ToList();
  2110. //开课教研室
  2111. var departmentNameList = enlist.Where(x => !string.IsNullOrEmpty(x.DepartmentName)).Select(x => x.DepartmentName.Trim()).ToList();
  2112. //对比后的newDepartmentList
  2113. var newDepartmentList = departmentList.Where(x => departmentNameList.Contains(x.Name)).ToList();
  2114. //是否启用
  2115. var generalPurposeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_GeneralPurpose).ToList();
  2116. //精品课程
  2117. var courseFineList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseFine).ToList();
  2118. //实践类型
  2119. var practiceTypeList = IdNameExt.GetDictionaryItem(DictionaryItem.EM_PracticeType).ToList();
  2120. //授课语言
  2121. var teachinglanguageList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Teachinglanguage).ToList();
  2122. //考试方式
  2123. var examinationModeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_ExaminationMode).ToList();
  2124. //成绩类型
  2125. var resultTypeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_ResultType).ToList();
  2126. //处理方式
  2127. var handleModeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_HandleMode).ToList();
  2128. //授课方式
  2129. var teachingModeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_TeachingMode).ToList();
  2130. //授课地点
  2131. var teachingPlaceList = IdNameExt.GetDictionaryItem(DictionaryItem.EM_TeachingPlace).ToList();
  2132. //专业计划
  2133. var specialtyPlanList = SpecialtyPlanDAL.SpecialtyPlanRepository
  2134. .GetList(x => true, (x => x.EM_SpecialtyPlanTeachingSetting)).ToList();
  2135. //对比后的newSpecialtyPlanList(暂时只对比年级专业ID、课程信息ID)
  2136. var newSpecialtyPlanList = specialtyPlanList.Where(x => grademajorIDList.Contains(x.GrademajorID)
  2137. && coursematerialIDList.Contains(x.CoursematerialID)).ToList();
  2138. //循环检测数据列,对各数据列进行验证(必填、字典项验证、数据格式等)
  2139. for (int i = 0; i < enlist.Count; i++)
  2140. {
  2141. SpecialtyPlanView en = enlist[i]; //Excel表数据视图
  2142. EM_SpecialtyPlan newSpecialtyPlan = new EM_SpecialtyPlan();
  2143. EM_SpecialtyPlanTeachingSetting newTeachingSetting = new EM_SpecialtyPlanTeachingSetting();
  2144. List<int> newModeTypeList = new List<int>();
  2145. List<int> newPlaceList = new List<int>();
  2146. //年级专业名称
  2147. if (string.IsNullOrWhiteSpace(en.GrademajorName))
  2148. {
  2149. errCount++;
  2150. errorMsgStr = "年级专业名称不能为空";
  2151. en.ErrorMessage = errorMsgStr;
  2152. errList.Add(en);
  2153. errorMsg.AppendLine(errorMsgStr);
  2154. continue;
  2155. }
  2156. else
  2157. {
  2158. var grademajor = newGrademajorList.Where(x => x.Name == en.GrademajorName.Trim()).SingleOrDefault();
  2159. if (grademajor == null)
  2160. {
  2161. errCount++;
  2162. errorMsgStr = "年级专业名称不存在,请检查";
  2163. en.ErrorMessage = errorMsgStr;
  2164. errList.Add(en);
  2165. errorMsg.AppendLine(errorMsgStr);
  2166. continue;
  2167. }
  2168. else
  2169. {
  2170. //年级专业ID
  2171. newSpecialtyPlan.GrademajorID = grademajor.GrademajorID;
  2172. //年级
  2173. en.GradeID = grademajor.GradeID;
  2174. //入学学期
  2175. en.StartSchoolcodeID = grademajor.SemesterID;
  2176. //毕业学期
  2177. en.GraduatingSemesterID = grademajor.GraduateSchoolyearID;
  2178. }
  2179. }
  2180. //开课学年
  2181. if (string.IsNullOrWhiteSpace(en.SchoolyearNumStr))
  2182. {
  2183. errCount++;
  2184. errorMsgStr = "开课学年不能为空";
  2185. en.ErrorMessage = errorMsgStr;
  2186. errList.Add(en);
  2187. errorMsg.AppendLine(errorMsgStr);
  2188. continue;
  2189. }
  2190. else
  2191. {
  2192. var schoolyearNum = schoolyearNumList.Where(x => x.Name == en.SchoolyearNumStr.Trim()).SingleOrDefault();
  2193. if (schoolyearNum == null)
  2194. {
  2195. errCount++;
  2196. errorMsgStr = "开课学年不存在,请检查";
  2197. en.ErrorMessage = errorMsgStr;
  2198. errList.Add(en);
  2199. errorMsg.AppendLine(errorMsgStr);
  2200. continue;
  2201. }
  2202. else
  2203. {
  2204. //开课学年
  2205. en.SchoolyearNumID = schoolyearNum.Value;
  2206. }
  2207. }
  2208. //学期
  2209. if (string.IsNullOrWhiteSpace(en.SchoolcodeStr))
  2210. {
  2211. errCount++;
  2212. errorMsgStr = "学期不能为空";
  2213. en.ErrorMessage = errorMsgStr;
  2214. errList.Add(en);
  2215. errorMsg.AppendLine(errorMsgStr);
  2216. continue;
  2217. }
  2218. else
  2219. {
  2220. var schoolcode = schoolcodeList.Where(x => x.Name == en.SchoolcodeStr.Trim()).SingleOrDefault();
  2221. if (schoolcode == null)
  2222. {
  2223. errCount++;
  2224. errorMsgStr = "学期不存在,请检查";
  2225. en.ErrorMessage = errorMsgStr;
  2226. errList.Add(en);
  2227. errorMsg.AppendLine(errorMsgStr);
  2228. continue;
  2229. }
  2230. else
  2231. {
  2232. //学期
  2233. en.SchoolcodeID = schoolcode.Value;
  2234. }
  2235. }
  2236. //学年学期
  2237. if (string.IsNullOrWhiteSpace(en.SchoolyearCode))
  2238. {
  2239. //暂不考虑
  2240. }
  2241. else
  2242. {
  2243. //暂不考虑
  2244. }
  2245. //查询对应的学年学期ID且匹配对应的学年学期(学年学期不为空时)
  2246. if (en.GradeID.HasValue && en.StartSchoolcodeID.HasValue && en.GraduatingSemesterID.HasValue && en.SchoolyearNumID.HasValue && en.SchoolcodeID.HasValue)
  2247. {
  2248. //查询年级专业对应的入学学年学期信息
  2249. var startSchoolyear = schoolyearList.Where(x => x.Years == en.GradeID && x.SchoolcodeID == en.StartSchoolcodeID).SingleOrDefault();
  2250. if (startSchoolyear == null)
  2251. {
  2252. errCount++;
  2253. errorMsgStr = "年级专业对应的入学学期不存在,请检查";
  2254. en.ErrorMessage = errorMsgStr;
  2255. errList.Add(en);
  2256. errorMsg.AppendLine(errorMsgStr);
  2257. continue;
  2258. }
  2259. else
  2260. {
  2261. //查询年级专业对应的毕业学年学期信息
  2262. var graduatingSemester = schoolyearList.Where(x => x.SchoolyearID == en.GraduatingSemesterID).SingleOrDefault();
  2263. if (graduatingSemester == null)
  2264. {
  2265. errCount++;
  2266. errorMsgStr = "年级专业对应的毕业学期不存在,请检查";
  2267. en.ErrorMessage = errorMsgStr;
  2268. errList.Add(en);
  2269. errorMsg.AppendLine(errorMsgStr);
  2270. continue;
  2271. }
  2272. else
  2273. {
  2274. //查询对应的学年学期信息
  2275. var yearID = Convert.ToInt32(en.GradeID + en.SchoolyearNumID - 1);
  2276. var schoolyear = schoolyearList.Where(x => x.Years == yearID && x.SchoolcodeID == en.SchoolcodeID).SingleOrDefault();
  2277. if (schoolyear == null)
  2278. {
  2279. errCount++;
  2280. errorMsgStr = "无法计算出对应的学年学期信息(以开课学年、学期、年级计算),请检查";
  2281. en.ErrorMessage = errorMsgStr;
  2282. errList.Add(en);
  2283. errorMsg.AppendLine(errorMsgStr);
  2284. continue;
  2285. }
  2286. else
  2287. {
  2288. //判断学年学期(以计算出的学年学期为准)
  2289. if (string.IsNullOrWhiteSpace(en.SchoolyearCode))
  2290. {
  2291. //暂不考虑
  2292. }
  2293. else
  2294. {
  2295. //学年学期与计算出的学年学期不对应
  2296. if (schoolyear.Code.Trim() != en.SchoolyearCode.Trim())
  2297. {
  2298. errCount++;
  2299. errorMsgStr = "学年学期与计算出的学年学期不对应(以计算出的学年学期为准),请检查";
  2300. en.ErrorMessage = errorMsgStr;
  2301. errList.Add(en);
  2302. errorMsg.AppendLine(errorMsgStr);
  2303. continue;
  2304. }
  2305. }
  2306. //学年学期小于入学学年学期
  2307. if (schoolyear.Value < startSchoolyear.Value)
  2308. {
  2309. errCount++;
  2310. errorMsgStr = "学年学期小于年级专业对应的入学学年学期(以计算出的学年学期为准),请检查";
  2311. en.ErrorMessage = errorMsgStr;
  2312. errList.Add(en);
  2313. errorMsg.AppendLine(errorMsgStr);
  2314. continue;
  2315. }
  2316. //学年学期大于毕业学年学期
  2317. if (schoolyear.Value > graduatingSemester.Value)
  2318. {
  2319. errCount++;
  2320. errorMsgStr = "学年学期大于年级专业对应的毕业学年学期(以计算出的学年学期为准),请检查";
  2321. en.ErrorMessage = errorMsgStr;
  2322. errList.Add(en);
  2323. errorMsg.AppendLine(errorMsgStr);
  2324. continue;
  2325. }
  2326. //学年学期ID
  2327. newSpecialtyPlan.SchoolyearID = schoolyear.SchoolyearID;
  2328. }
  2329. }
  2330. }
  2331. }
  2332. else
  2333. {
  2334. errCount++;
  2335. errorMsgStr = "数据有误,请检查(开课学年、学期、年级、入学学期或毕业学期不能为空)";
  2336. en.ErrorMessage = errorMsgStr;
  2337. errList.Add(en);
  2338. errorMsg.AppendLine(errorMsgStr);
  2339. continue;
  2340. }
  2341. //课程代码
  2342. if (string.IsNullOrWhiteSpace(en.CourseCode))
  2343. {
  2344. errCount++;
  2345. errorMsgStr = "课程代码不能为空";
  2346. en.ErrorMessage = errorMsgStr;
  2347. errList.Add(en);
  2348. errorMsg.AppendLine(errorMsgStr);
  2349. continue;
  2350. }
  2351. else
  2352. {
  2353. reg = new Regex(@"^[0-9a-zA-Z\s?]+$"); //正则表达式(请输入数字或英文字母)
  2354. if (!reg.IsMatch(en.CourseCode.Trim()))
  2355. {
  2356. errCount++;
  2357. errorMsgStr = "课程代码格式不正确,请检查(数字或英文字母)";
  2358. en.ErrorMessage = errorMsgStr;
  2359. errList.Add(en);
  2360. errorMsg.AppendLine(errorMsgStr);
  2361. continue;
  2362. }
  2363. else
  2364. {
  2365. var course = newCourseList.Where(x => x.CourseCode == en.CourseCode.Trim()).SingleOrDefault();
  2366. if (course == null)
  2367. {
  2368. errCount++;
  2369. errorMsgStr = "课程代码不存在,请检查";
  2370. en.ErrorMessage = errorMsgStr;
  2371. errList.Add(en);
  2372. errorMsg.AppendLine(errorMsgStr);
  2373. continue;
  2374. }
  2375. else
  2376. {
  2377. //判断课程代码与课程名称(以课程代码为准)
  2378. if (string.IsNullOrWhiteSpace(en.CourseName))
  2379. {
  2380. //暂不考虑
  2381. }
  2382. else
  2383. {
  2384. //课程代码与课程名称不对应
  2385. if (course.CourseName.Trim() != en.CourseName.Trim())
  2386. {
  2387. errCount++;
  2388. errorMsgStr = "课程代码与课程名称不对应(以课程代码为准),请检查";
  2389. en.ErrorMessage = errorMsgStr;
  2390. errList.Add(en);
  2391. errorMsg.AppendLine(errorMsgStr);
  2392. continue;
  2393. }
  2394. }
  2395. //判断对应的课程信息状态(启用、禁用状态)
  2396. if (course.IsEnable == true)
  2397. {
  2398. //课程信息ID
  2399. newSpecialtyPlan.CoursematerialID = course.CoursematerialID;
  2400. }
  2401. else
  2402. {
  2403. newSpecialtyPlan.CoursematerialID = course.CoursematerialID;
  2404. errCount++;
  2405. errorMsgStr = "对应的课程信息为禁用状态,请检查";
  2406. en.ErrorMessage = errorMsgStr;
  2407. errList.Add(en);
  2408. errorMsg.AppendLine(errorMsgStr);
  2409. continue;
  2410. }
  2411. }
  2412. }
  2413. }
  2414. //课程名称
  2415. if (string.IsNullOrWhiteSpace(en.CourseName))
  2416. {
  2417. //暂不考虑
  2418. }
  2419. else
  2420. {
  2421. //暂不考虑
  2422. }
  2423. //课程结构
  2424. if (string.IsNullOrWhiteSpace(en.CourseStructureStr))
  2425. {
  2426. newSpecialtyPlan.CourseStructureID = (int)CF_CourseStructure.ClassroomTeaching;
  2427. }
  2428. else
  2429. {
  2430. var courseStructure = courseStructureList.Where(x => x.Name == en.CourseStructureStr.Trim()).SingleOrDefault();
  2431. if (courseStructure == null)
  2432. {
  2433. errCount++;
  2434. errorMsgStr = "课程结构不存在,请检查";
  2435. en.ErrorMessage = errorMsgStr;
  2436. errList.Add(en);
  2437. errorMsg.AppendLine(errorMsgStr);
  2438. continue;
  2439. }
  2440. else
  2441. {
  2442. //课程结构
  2443. newSpecialtyPlan.CourseStructureID = courseStructure.Value;
  2444. }
  2445. }
  2446. //课程属性
  2447. if (string.IsNullOrWhiteSpace(en.CourseCategoryStr))
  2448. {
  2449. newSpecialtyPlan.CourseCategoryID = (int)CF_CourseCategory.Publiccourse;
  2450. }
  2451. else
  2452. {
  2453. var courseCategory = courseCategoryList.Where(x => x.Name == en.CourseCategoryStr.Trim()).SingleOrDefault();
  2454. if (courseCategory == null)
  2455. {
  2456. errCount++;
  2457. errorMsgStr = "课程属性不存在,请检查";
  2458. en.ErrorMessage = errorMsgStr;
  2459. errList.Add(en);
  2460. errorMsg.AppendLine(errorMsgStr);
  2461. continue;
  2462. }
  2463. else
  2464. {
  2465. //课程属性
  2466. newSpecialtyPlan.CourseCategoryID = courseCategory.Value;
  2467. }
  2468. }
  2469. //课程类型
  2470. if (string.IsNullOrWhiteSpace(en.CourseTypeStr))
  2471. {
  2472. errCount++;
  2473. errorMsgStr = "课程类型不能为空";
  2474. en.ErrorMessage = errorMsgStr;
  2475. errList.Add(en);
  2476. errorMsg.AppendLine(errorMsgStr);
  2477. continue;
  2478. }
  2479. else
  2480. {
  2481. var courseType = courseTypeList.Where(x => x.Name == en.CourseTypeStr.Trim()).SingleOrDefault();
  2482. if (courseType == null)
  2483. {
  2484. errCount++;
  2485. errorMsgStr = "课程类型不存在,请检查";
  2486. en.ErrorMessage = errorMsgStr;
  2487. errList.Add(en);
  2488. errorMsg.AppendLine(errorMsgStr);
  2489. continue;
  2490. }
  2491. else
  2492. {
  2493. //课程类型
  2494. newSpecialtyPlan.CourseTypeID = courseType.Value;
  2495. }
  2496. }
  2497. //课程性质
  2498. if (string.IsNullOrWhiteSpace(en.CourseQualityStr))
  2499. {
  2500. newSpecialtyPlan.CourseQualityID = (int)CF_CourseQuality.Required;
  2501. }
  2502. else
  2503. {
  2504. var courseQuality = courseQualityList.Where(x => x.Name == en.CourseQualityStr.Trim()).SingleOrDefault();
  2505. if (courseQuality == null)
  2506. {
  2507. errCount++;
  2508. errorMsgStr = "课程性质不存在,请检查";
  2509. en.ErrorMessage = errorMsgStr;
  2510. errList.Add(en);
  2511. errorMsg.AppendLine(errorMsgStr);
  2512. continue;
  2513. }
  2514. else
  2515. {
  2516. //课程性质
  2517. newSpecialtyPlan.CourseQualityID = courseQuality.Value;
  2518. }
  2519. }
  2520. //课程学分
  2521. if (string.IsNullOrWhiteSpace(en.CreditStr))
  2522. {
  2523. errCount++;
  2524. errorMsgStr = "课程学分不能为空";
  2525. en.ErrorMessage = errorMsgStr;
  2526. errList.Add(en);
  2527. errorMsg.AppendLine(errorMsgStr);
  2528. continue;
  2529. }
  2530. else
  2531. {
  2532. reg = new Regex(@"^[0-9]+([.]{1}[0-9]+){0,1}$"); //课程学分字段正则表达式()
  2533. if (!reg.IsMatch(en.CreditStr.Trim()))
  2534. {
  2535. errCount++;
  2536. errorMsgStr = "课程学分格式不正确,请检查";
  2537. en.ErrorMessage = errorMsgStr;
  2538. errList.Add(en);
  2539. errorMsg.AppendLine(errorMsgStr);
  2540. continue;
  2541. }
  2542. else
  2543. {
  2544. //课程学分
  2545. newTeachingSetting.Credit = Convert.ToDecimal(en.CreditStr.Trim());
  2546. }
  2547. }
  2548. //理论学时
  2549. if (string.IsNullOrWhiteSpace(en.TheoryCourseStr))
  2550. {
  2551. errCount++;
  2552. errorMsgStr = "理论学时不能为空";
  2553. en.ErrorMessage = errorMsgStr;
  2554. errList.Add(en);
  2555. errorMsg.AppendLine(errorMsgStr);
  2556. continue;
  2557. }
  2558. else
  2559. {
  2560. reg = new Regex(@"^\d+$"); //正则表达式(非负整数)
  2561. if (!reg.IsMatch(en.TheoryCourseStr.Trim()))
  2562. {
  2563. errCount++;
  2564. errorMsgStr = "理论学时格式不正确,请检查";
  2565. en.ErrorMessage = errorMsgStr;
  2566. errList.Add(en);
  2567. errorMsg.AppendLine(errorMsgStr);
  2568. continue;
  2569. }
  2570. else
  2571. {
  2572. //理论学时
  2573. newTeachingSetting.TheoryCourse = Convert.ToInt32(en.TheoryCourseStr.Trim());
  2574. }
  2575. }
  2576. //实践学时
  2577. if (string.IsNullOrWhiteSpace(en.PracticehoursStr))
  2578. {
  2579. errCount++;
  2580. errorMsgStr = "实践学时不能为空";
  2581. en.ErrorMessage = errorMsgStr;
  2582. errList.Add(en);
  2583. errorMsg.AppendLine(errorMsgStr);
  2584. continue;
  2585. }
  2586. else
  2587. {
  2588. reg = new Regex(@"^\d+$"); //正则表达式(非负整数)
  2589. if (!reg.IsMatch(en.PracticehoursStr.Trim()))
  2590. {
  2591. errCount++;
  2592. errorMsgStr = "实践学时格式不正确,请检查";
  2593. en.ErrorMessage = errorMsgStr;
  2594. errList.Add(en);
  2595. errorMsg.AppendLine(errorMsgStr);
  2596. continue;
  2597. }
  2598. else
  2599. {
  2600. //实践学时
  2601. newTeachingSetting.Practicehours = Convert.ToInt32(en.PracticehoursStr.Trim());
  2602. }
  2603. }
  2604. //实验学时
  2605. if (string.IsNullOrWhiteSpace(en.TrialhoursStr))
  2606. {
  2607. newTeachingSetting.Trialhours = 0;
  2608. }
  2609. else
  2610. {
  2611. reg = new Regex(@"^\d+$"); //正则表达式(非负整数)
  2612. if (!reg.IsMatch(en.TrialhoursStr.Trim()))
  2613. {
  2614. errCount++;
  2615. errorMsgStr = "实验学时格式不正确,请检查";
  2616. en.ErrorMessage = errorMsgStr;
  2617. errList.Add(en);
  2618. errorMsg.AppendLine(errorMsgStr);
  2619. continue;
  2620. }
  2621. else
  2622. {
  2623. //实验学时
  2624. newTeachingSetting.Trialhours = Convert.ToInt32(en.TrialhoursStr.Trim());
  2625. }
  2626. }
  2627. //理论周次
  2628. if (string.IsNullOrWhiteSpace(en.TheoryWeeklyNumStr))
  2629. {
  2630. newTeachingSetting.TheoryWeeklyNum = 0;
  2631. }
  2632. else
  2633. {
  2634. reg = new Regex(@"^\d+$"); //正则表达式(非负整数)
  2635. if (!reg.IsMatch(en.TheoryWeeklyNumStr.Trim()))
  2636. {
  2637. errCount++;
  2638. errorMsgStr = "理论周次格式不正确,请检查";
  2639. en.ErrorMessage = errorMsgStr;
  2640. errList.Add(en);
  2641. errorMsg.AppendLine(errorMsgStr);
  2642. continue;
  2643. }
  2644. else
  2645. {
  2646. //理论周次
  2647. newTeachingSetting.TheoryWeeklyNum = Convert.ToInt32(en.TheoryWeeklyNumStr.Trim());
  2648. }
  2649. }
  2650. //实践周次
  2651. if (string.IsNullOrWhiteSpace(en.PracticeWeeklyNumStr))
  2652. {
  2653. newTeachingSetting.PracticeWeeklyNum = 0;
  2654. }
  2655. else
  2656. {
  2657. reg = new Regex(@"^\d+$"); //正则表达式(非负整数)
  2658. if (!reg.IsMatch(en.PracticeWeeklyNumStr.Trim()))
  2659. {
  2660. errCount++;
  2661. errorMsgStr = "实践周次格式不正确,请检查";
  2662. en.ErrorMessage = errorMsgStr;
  2663. errList.Add(en);
  2664. errorMsg.AppendLine(errorMsgStr);
  2665. continue;
  2666. }
  2667. else
  2668. {
  2669. //实践周次
  2670. newTeachingSetting.PracticeWeeklyNum = Convert.ToInt32(en.PracticeWeeklyNumStr.Trim());
  2671. }
  2672. }
  2673. //实验周次
  2674. if (string.IsNullOrWhiteSpace(en.TrialWeeklyNumStr))
  2675. {
  2676. newTeachingSetting.TrialWeeklyNum = 0;
  2677. }
  2678. else
  2679. {
  2680. reg = new Regex(@"^\d+$"); //正则表达式(非负整数)
  2681. if (!reg.IsMatch(en.TrialWeeklyNumStr.Trim()))
  2682. {
  2683. errCount++;
  2684. errorMsgStr = "实验周次格式不正确,请检查";
  2685. en.ErrorMessage = errorMsgStr;
  2686. errList.Add(en);
  2687. errorMsg.AppendLine(errorMsgStr);
  2688. continue;
  2689. }
  2690. else
  2691. {
  2692. //实践周次
  2693. newTeachingSetting.TrialWeeklyNum = Convert.ToInt32(en.TrialWeeklyNumStr.Trim());
  2694. }
  2695. }
  2696. //开课教研室
  2697. if (string.IsNullOrWhiteSpace(en.DepartmentName))
  2698. {
  2699. errCount++;
  2700. errorMsgStr = "开课教研室不能为空";
  2701. en.ErrorMessage = errorMsgStr;
  2702. errList.Add(en);
  2703. errorMsg.AppendLine(errorMsgStr);
  2704. continue;
  2705. }
  2706. else
  2707. {
  2708. var department = newDepartmentList.Where(x => x.Name == en.DepartmentName.Trim()).SingleOrDefault();
  2709. if (department == null)
  2710. {
  2711. errCount++;
  2712. errorMsgStr = "开课教研室不存在,请检查";
  2713. en.ErrorMessage = errorMsgStr;
  2714. errList.Add(en);
  2715. errorMsg.AppendLine(errorMsgStr);
  2716. continue;
  2717. }
  2718. else
  2719. {
  2720. //教研室信息ID
  2721. newSpecialtyPlan.DepartmentID = department.DepartmentID;
  2722. }
  2723. }
  2724. //是否专业核心
  2725. if (string.IsNullOrWhiteSpace(en.IsSpecialtycoreStr))
  2726. {
  2727. //是否专业核心(默认为否)
  2728. newSpecialtyPlan.IsSpecialtycore = false;
  2729. }
  2730. else
  2731. {
  2732. var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsSpecialtycoreStr.Trim()).SingleOrDefault();
  2733. if (generalPurpose == null)
  2734. {
  2735. errCount++;
  2736. errorMsgStr = "是否专业核心不存在,请检查";
  2737. en.ErrorMessage = errorMsgStr;
  2738. errList.Add(en);
  2739. errorMsg.AppendLine(errorMsgStr);
  2740. continue;
  2741. }
  2742. else
  2743. {
  2744. //是否专业核心
  2745. newSpecialtyPlan.IsSpecialtycore = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
  2746. }
  2747. }
  2748. //是否合作开发
  2749. if (string.IsNullOrWhiteSpace(en.IsCooperationStr))
  2750. {
  2751. //是否合作开发(默认为否)
  2752. newSpecialtyPlan.IsCooperation = false;
  2753. }
  2754. else
  2755. {
  2756. var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsCooperationStr.Trim()).SingleOrDefault();
  2757. if (generalPurpose == null)
  2758. {
  2759. errCount++;
  2760. errorMsgStr = "是否合作开发不存在,请检查";
  2761. en.ErrorMessage = errorMsgStr;
  2762. errList.Add(en);
  2763. errorMsg.AppendLine(errorMsgStr);
  2764. continue;
  2765. }
  2766. else
  2767. {
  2768. //是否合作开发
  2769. newSpecialtyPlan.IsCooperation = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
  2770. }
  2771. }
  2772. //是否必修课
  2773. if (string.IsNullOrWhiteSpace(en.IsRequiredStr))
  2774. {
  2775. //是否必修课(默认为否)
  2776. newSpecialtyPlan.IsRequired = false;
  2777. }
  2778. else
  2779. {
  2780. var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsRequiredStr.Trim()).SingleOrDefault();
  2781. if (generalPurpose == null)
  2782. {
  2783. errCount++;
  2784. errorMsgStr = RSL.Get("IsRequired") + "不存在,请检查";
  2785. en.ErrorMessage = errorMsgStr;
  2786. errList.Add(en);
  2787. errorMsg.AppendLine(errorMsgStr);
  2788. continue;
  2789. }
  2790. else
  2791. {
  2792. //是否必修课
  2793. newSpecialtyPlan.IsRequired = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
  2794. }
  2795. }
  2796. //是否网上选修
  2797. if (string.IsNullOrWhiteSpace(en.IsElectiveStr))
  2798. {
  2799. //是否网上选修(默认为否)
  2800. newSpecialtyPlan.IsElective = false;
  2801. }
  2802. else
  2803. {
  2804. var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsElectiveStr.Trim()).SingleOrDefault();
  2805. if (generalPurpose == null)
  2806. {
  2807. errCount++;
  2808. errorMsgStr = "是否网上选修不存在,请检查";
  2809. en.ErrorMessage = errorMsgStr;
  2810. errList.Add(en);
  2811. errorMsg.AppendLine(errorMsgStr);
  2812. continue;
  2813. }
  2814. else
  2815. {
  2816. //是否网上选修
  2817. newSpecialtyPlan.IsElective = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
  2818. }
  2819. }
  2820. //是否网络课程
  2821. if (string.IsNullOrWhiteSpace(en.IsNetworkCourseStr))
  2822. {
  2823. //是否网络课程(默认为否)
  2824. newSpecialtyPlan.IsNetworkCourse = false;
  2825. }
  2826. else
  2827. {
  2828. var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsNetworkCourseStr.Trim()).SingleOrDefault();
  2829. if (generalPurpose == null)
  2830. {
  2831. errCount++;
  2832. errorMsgStr = "是否网络课程不存在,请检查";
  2833. en.ErrorMessage = errorMsgStr;
  2834. errList.Add(en);
  2835. errorMsg.AppendLine(errorMsgStr);
  2836. continue;
  2837. }
  2838. else
  2839. {
  2840. //是否网络课程
  2841. newSpecialtyPlan.IsNetworkCourse = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
  2842. }
  2843. }
  2844. //是否学位课程
  2845. if (string.IsNullOrWhiteSpace(en.IsMainCourseStr))
  2846. {
  2847. //是否学位课程(默认为否)
  2848. newSpecialtyPlan.IsMainCourse = false;
  2849. }
  2850. else
  2851. {
  2852. var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsMainCourseStr.Trim()).SingleOrDefault();
  2853. if (generalPurpose == null)
  2854. {
  2855. errCount++;
  2856. errorMsgStr = "是否学位课程不存在,请检查";
  2857. en.ErrorMessage = errorMsgStr;
  2858. errList.Add(en);
  2859. errorMsg.AppendLine(errorMsgStr);
  2860. continue;
  2861. }
  2862. else
  2863. {
  2864. //是否学位课程
  2865. newSpecialtyPlan.IsMainCourse = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
  2866. }
  2867. }
  2868. //是否需要教材
  2869. if (string.IsNullOrWhiteSpace(en.IsNeedMaterialStr))
  2870. {
  2871. //是否需要教材(默认为是)
  2872. newSpecialtyPlan.IsNeedMaterial = true;
  2873. }
  2874. else
  2875. {
  2876. var generalPurpose = generalPurposeList.Where(x => x.Name == en.IsNeedMaterialStr.Trim()).SingleOrDefault();
  2877. if (generalPurpose == null)
  2878. {
  2879. errCount++;
  2880. errorMsgStr = "是否需要教材不存在,请检查";
  2881. en.ErrorMessage = errorMsgStr;
  2882. errList.Add(en);
  2883. errorMsg.AppendLine(errorMsgStr);
  2884. continue;
  2885. }
  2886. else
  2887. {
  2888. //是否需要教材
  2889. newSpecialtyPlan.IsNeedMaterial = generalPurpose.Value == (int)CF_GeneralPurpose.IsYes ? true : false;
  2890. }
  2891. }
  2892. //精品课程
  2893. if (string.IsNullOrWhiteSpace(en.CourseFineStr))
  2894. {
  2895. newSpecialtyPlan.CourseFineID = (int)CF_CourseFine.No;
  2896. }
  2897. else
  2898. {
  2899. var courseFine = courseFineList.Where(x => x.Name == en.CourseFineStr.Trim()).SingleOrDefault();
  2900. if (courseFine == null)
  2901. {
  2902. errCount++;
  2903. errorMsgStr = "精品课程不存在,请检查";
  2904. en.ErrorMessage = errorMsgStr;
  2905. errList.Add(en);
  2906. errorMsg.AppendLine(errorMsgStr);
  2907. continue;
  2908. }
  2909. else
  2910. {
  2911. //精品课程
  2912. newSpecialtyPlan.CourseFineID = courseFine.Value;
  2913. }
  2914. }
  2915. //实践类型
  2916. if (string.IsNullOrWhiteSpace(en.PracticeTypeStr))
  2917. {
  2918. //不考虑
  2919. }
  2920. else
  2921. {
  2922. var practiceType = practiceTypeList.Where(x => x.Name == en.PracticeTypeStr.Trim()).SingleOrDefault();
  2923. if (practiceType == null)
  2924. {
  2925. errCount++;
  2926. errorMsgStr = "实践类型不存在,请检查";
  2927. en.ErrorMessage = errorMsgStr;
  2928. errList.Add(en);
  2929. errorMsg.AppendLine(errorMsgStr);
  2930. continue;
  2931. }
  2932. else
  2933. {
  2934. //实践类型
  2935. newSpecialtyPlan.PracticeTypeID = practiceType.Value;
  2936. }
  2937. }
  2938. //授课语言
  2939. if (string.IsNullOrWhiteSpace(en.TeachinglanguageStr))
  2940. {
  2941. newSpecialtyPlan.TeachinglanguageID = (int)CF_Teachinglanguage.Chinese;
  2942. }
  2943. else
  2944. {
  2945. var teachinglanguage = teachinglanguageList.Where(x => x.Name == en.TeachinglanguageStr.Trim()).SingleOrDefault();
  2946. if (teachinglanguage == null)
  2947. {
  2948. errCount++;
  2949. errorMsgStr = "授课语言不存在,请检查";
  2950. en.ErrorMessage = errorMsgStr;
  2951. errList.Add(en);
  2952. errorMsg.AppendLine(errorMsgStr);
  2953. continue;
  2954. }
  2955. else
  2956. {
  2957. //授课语言
  2958. newSpecialtyPlan.TeachinglanguageID = teachinglanguage.Value;
  2959. }
  2960. }
  2961. //考试方式
  2962. if (string.IsNullOrWhiteSpace(en.ExaminationModeStr))
  2963. {
  2964. newSpecialtyPlan.ExaminationModeID = (int)CF_ExaminationMode.WrittenExam;
  2965. }
  2966. else
  2967. {
  2968. var examinationMode = examinationModeList.Where(x => x.Name == en.ExaminationModeStr.Trim()).SingleOrDefault();
  2969. if (examinationMode == null)
  2970. {
  2971. errCount++;
  2972. errorMsgStr = "考试方式不存在,请检查";
  2973. en.ErrorMessage = errorMsgStr;
  2974. errList.Add(en);
  2975. errorMsg.AppendLine(errorMsgStr);
  2976. continue;
  2977. }
  2978. else
  2979. {
  2980. //考试方式
  2981. newSpecialtyPlan.ExaminationModeID = examinationMode.Value;
  2982. }
  2983. }
  2984. //成绩类型
  2985. if (string.IsNullOrWhiteSpace(en.ResultTypeStr))
  2986. {
  2987. newSpecialtyPlan.ResultTypeID = (int)CF_ResultType.Percentage;
  2988. }
  2989. else
  2990. {
  2991. var resultType = resultTypeList.Where(x => x.Name == en.ResultTypeStr.Trim()).SingleOrDefault();
  2992. if (resultType == null)
  2993. {
  2994. errCount++;
  2995. errorMsgStr = "成绩类型不存在,请检查";
  2996. en.ErrorMessage = errorMsgStr;
  2997. errList.Add(en);
  2998. errorMsg.AppendLine(errorMsgStr);
  2999. continue;
  3000. }
  3001. else
  3002. {
  3003. //成绩类型
  3004. newSpecialtyPlan.ResultTypeID = resultType.Value;
  3005. }
  3006. }
  3007. //处理方式
  3008. if (string.IsNullOrWhiteSpace(en.HandleModeStr))
  3009. {
  3010. newSpecialtyPlan.HandleModeID = (int)CF_HandleMode.RequiredCourse;
  3011. }
  3012. else
  3013. {
  3014. var handleMode = handleModeList.Where(x => x.Name == en.HandleModeStr.Trim()).SingleOrDefault();
  3015. if (handleMode == null)
  3016. {
  3017. errCount++;
  3018. errorMsgStr = "处理方式不存在,请检查";
  3019. en.ErrorMessage = errorMsgStr;
  3020. errList.Add(en);
  3021. errorMsg.AppendLine(errorMsgStr);
  3022. continue;
  3023. }
  3024. else
  3025. {
  3026. //处理方式
  3027. newSpecialtyPlan.HandleModeID = handleMode.Value;
  3028. }
  3029. }
  3030. //授课方式
  3031. if (string.IsNullOrWhiteSpace(en.TeachingModeIDListStr))
  3032. {
  3033. newModeTypeList.Add((int)CF_TeachingMode.Theory);
  3034. }
  3035. else
  3036. {
  3037. //授课方式可为多个(可用顿号隔开)
  3038. List<string> list = en.TeachingModeIDListStr.Split('、').Where(x => !string.IsNullOrEmpty(x))
  3039. .Select(x => x.Trim()).Distinct().ToList();
  3040. foreach (var item in list)
  3041. {
  3042. var teachingMode = teachingModeList.Where(x => x.Name == item.Trim()).SingleOrDefault();
  3043. if (teachingMode == null)
  3044. {
  3045. errCount++;
  3046. errorMsgStr = "授课方式(" + item.Trim() + ")不存在,请检查(存在多个授课方式时,可用顿号隔开)";
  3047. en.ErrorMessage = errorMsgStr;
  3048. errList.Add(en);
  3049. errorMsg.AppendLine(errorMsgStr);
  3050. isListPass = false;
  3051. break;
  3052. }
  3053. }
  3054. if (isListPass)
  3055. {
  3056. newModeTypeList = teachingModeList.Where(x => list.Contains(x.Name))
  3057. .Select(x => x.Value.Value).ToList();
  3058. }
  3059. else
  3060. {
  3061. isListPass = true;
  3062. continue;
  3063. }
  3064. }
  3065. //授课地点
  3066. if (string.IsNullOrWhiteSpace(en.TeachingPlaceIDListStr))
  3067. {
  3068. newPlaceList.Add((int)EMIS.ViewModel.EM_TeachingPlace.Multimedia);
  3069. }
  3070. else
  3071. {
  3072. //授课地点可为多个(可用顿号隔开)
  3073. List<string> list = en.TeachingPlaceIDListStr.Split('、').Where(x => !string.IsNullOrEmpty(x))
  3074. .Select(x => x.Trim()).Distinct().ToList();
  3075. foreach (var item in list)
  3076. {
  3077. var teachingPlace = teachingPlaceList.Where(x => x.Name == item.Trim()).SingleOrDefault();
  3078. if (teachingPlace == null)
  3079. {
  3080. errCount++;
  3081. errorMsgStr = "授课地点(" + item.Trim() + ")不存在,请检查(存在多个授课地点时,可用顿号隔开)";
  3082. en.ErrorMessage = errorMsgStr;
  3083. errList.Add(en);
  3084. errorMsg.AppendLine(errorMsgStr);
  3085. isListPass = false;
  3086. break;
  3087. }
  3088. }
  3089. if (isListPass)
  3090. {
  3091. newPlaceList = teachingPlaceList.Where(x => list.Contains(x.Name))
  3092. .Select(x => x.Value.Value).ToList();
  3093. }
  3094. else
  3095. {
  3096. isListPass = true;
  3097. continue;
  3098. }
  3099. }
  3100. //备注
  3101. if (string.IsNullOrWhiteSpace(en.Remark))
  3102. {
  3103. //不考虑
  3104. }
  3105. else
  3106. {
  3107. newSpecialtyPlan.Remark = en.Remark;
  3108. }
  3109. ////Excel表重复性验证(注:当数据表中没有此记录,但是Excel中有重复数据时的去掉)
  3110. //for (int j = i + 1; j < enlist.Count; j++)
  3111. //{
  3112. // SpecialtyPlanView enA = enlist[j];
  3113. // //根据Excel表中的业务主键进行去重(学年学期ID、年级专业ID、课程信息ID唯一)
  3114. // if (en.No == enA.No && en.Name == enA.Name)
  3115. // {
  3116. // //用于标识Excel表中的重复记录(由于是批量进行插入数据表)
  3117. // }
  3118. //}
  3119. //数据表重复性验证(学年学期ID、年级专业ID、课程信息ID唯一)
  3120. var specialtyPlanVerification = newSpecialtyPlanList.Where(x => x.SchoolyearID == newSpecialtyPlan.SchoolyearID
  3121. && x.GrademajorID == newSpecialtyPlan.GrademajorID
  3122. && x.CoursematerialID == newSpecialtyPlan.CoursematerialID).SingleOrDefault();
  3123. if (specialtyPlanVerification == null)
  3124. {
  3125. //新增
  3126. if (!newSpecialtyPlanInList.Any(x => x.SchoolyearID == newSpecialtyPlan.SchoolyearID
  3127. && x.GrademajorID == newSpecialtyPlan.GrademajorID
  3128. && x.CoursematerialID == newSpecialtyPlan.CoursematerialID))
  3129. {
  3130. newSpecialtyPlan.SpecialtyPlanID = Guid.NewGuid();
  3131. SetNewStatus(newSpecialtyPlan);
  3132. newSpecialtyPlanInList.Add(newSpecialtyPlan);
  3133. newTeachingSetting.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
  3134. //newTeachingSetting.TheoryWeeklyNum = 0;
  3135. //newTeachingSetting.PracticeWeeklyNum = 0;
  3136. //newTeachingSetting.TrialWeeklyNum = 0;
  3137. newTeachingSetting.WeeklyHours = 0;
  3138. newTeachingSetting.WeeklyNum = 0;
  3139. newTeachingSetting.StartWeeklyNum = 1;
  3140. newTeachingSetting.EndWeeklyNum = 16;
  3141. newTeachingSettingInList.Add(newTeachingSetting);
  3142. if (newModeTypeList != null && newModeTypeList.Count() > 0)
  3143. {
  3144. foreach (var newModeType in newModeTypeList)
  3145. {
  3146. var newTeachingModeType = new EM_SpecialtyPlanTeachingModeType();
  3147. newTeachingModeType.SpecialtyPlanTeachingModeTypeID = Guid.NewGuid();
  3148. newTeachingModeType.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
  3149. newTeachingModeType.TeachingModeID = newModeType;
  3150. this.SetNewStatus(newTeachingModeType);
  3151. newTeachingModeTypeInList.Add(newTeachingModeType);
  3152. }
  3153. }
  3154. if (newPlaceList != null && newPlaceList.Count() > 0)
  3155. {
  3156. foreach (var newPlace in newPlaceList)
  3157. {
  3158. var newTeachingPlace = new EM_SpecialtyPlanTeachingPlace();
  3159. newTeachingPlace.SpecialtyPlanTeachingPlaceID = Guid.NewGuid();
  3160. newTeachingPlace.SpecialtyPlanID = newSpecialtyPlan.SpecialtyPlanID;
  3161. newTeachingPlace.TeachingPlace = newPlace;
  3162. this.SetNewStatus(newTeachingPlace);
  3163. newTeachingPlaceInList.Add(newTeachingPlace);
  3164. }
  3165. }
  3166. inCount++;
  3167. }
  3168. else
  3169. {
  3170. //Excel表重复性验证
  3171. //(注:当数据表中没有此记录,但是Excel中有重复数据,可在此处进行抛出到失败数据文件中,目前暂不考虑)
  3172. inCount++;
  3173. }
  3174. }
  3175. else
  3176. {
  3177. //更新(Excel有重复时,以最后一条记录的更新为准)
  3178. specialtyPlanVerification.CourseStructureID = newSpecialtyPlan.CourseStructureID;
  3179. specialtyPlanVerification.CourseCategoryID = newSpecialtyPlan.CourseCategoryID;
  3180. specialtyPlanVerification.CourseTypeID = newSpecialtyPlan.CourseTypeID;
  3181. specialtyPlanVerification.CourseQualityID = newSpecialtyPlan.CourseQualityID;
  3182. specialtyPlanVerification.DepartmentID = newSpecialtyPlan.DepartmentID;
  3183. specialtyPlanVerification.IsSpecialtycore = newSpecialtyPlan.IsSpecialtycore;
  3184. specialtyPlanVerification.IsCooperation = newSpecialtyPlan.IsCooperation;
  3185. specialtyPlanVerification.IsRequired = newSpecialtyPlan.IsRequired;
  3186. specialtyPlanVerification.IsElective = newSpecialtyPlan.IsElective;
  3187. specialtyPlanVerification.IsNetworkCourse = newSpecialtyPlan.IsNetworkCourse;
  3188. specialtyPlanVerification.IsMainCourse = newSpecialtyPlan.IsMainCourse;
  3189. specialtyPlanVerification.IsNeedMaterial = newSpecialtyPlan.IsNeedMaterial;
  3190. specialtyPlanVerification.CourseFineID = newSpecialtyPlan.CourseFineID;
  3191. specialtyPlanVerification.PracticeTypeID = newSpecialtyPlan.PracticeTypeID;
  3192. specialtyPlanVerification.TeachinglanguageID = newSpecialtyPlan.TeachinglanguageID;
  3193. specialtyPlanVerification.ExaminationModeID = newSpecialtyPlan.ExaminationModeID;
  3194. specialtyPlanVerification.ResultTypeID = newSpecialtyPlan.ResultTypeID;
  3195. specialtyPlanVerification.HandleModeID = newSpecialtyPlan.HandleModeID;
  3196. specialtyPlanVerification.Remark = newSpecialtyPlan.Remark;
  3197. SetModifyStatus(specialtyPlanVerification);
  3198. newSpecialtyPlanUpList.Add(specialtyPlanVerification);
  3199. if (specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting == null)
  3200. {
  3201. if (newTeachingSettingInList.Any(x => x.SpecialtyPlanID == specialtyPlanVerification.SpecialtyPlanID))
  3202. {
  3203. newTeachingSettingInList.RemoveAll(x => x.SpecialtyPlanID == specialtyPlanVerification.SpecialtyPlanID);
  3204. }
  3205. newTeachingSetting.SpecialtyPlanID = specialtyPlanVerification.SpecialtyPlanID;
  3206. //newTeachingSetting.TheoryWeeklyNum = 0;
  3207. //newTeachingSetting.PracticeWeeklyNum = 0;
  3208. //newTeachingSetting.TrialWeeklyNum = 0;
  3209. newTeachingSetting.WeeklyHours = 0;
  3210. newTeachingSetting.WeeklyNum = 0;
  3211. newTeachingSetting.StartWeeklyNum = 1;
  3212. newTeachingSetting.EndWeeklyNum = 16;
  3213. newTeachingSettingInList.Add(newTeachingSetting);
  3214. }
  3215. else
  3216. {
  3217. specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.Credit = newTeachingSetting.Credit;
  3218. specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.TheoryCourse = newTeachingSetting.TheoryCourse;
  3219. specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.Practicehours = newTeachingSetting.Practicehours;
  3220. specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.Trialhours = newTeachingSetting.Trialhours;
  3221. specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.TheoryWeeklyNum = newTeachingSetting.TheoryWeeklyNum;
  3222. specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.PracticeWeeklyNum = newTeachingSetting.PracticeWeeklyNum;
  3223. specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting.TrialWeeklyNum = newTeachingSetting.TrialWeeklyNum;
  3224. newTeachingSettingUpList.Add(specialtyPlanVerification.EM_SpecialtyPlanTeachingSetting);
  3225. }
  3226. if (newModeTypeList != null && newModeTypeList.Count() > 0)
  3227. {
  3228. if (newTeachingModeTypeInList.Any(x => x.SpecialtyPlanID == specialtyPlanVerification.SpecialtyPlanID))
  3229. {
  3230. newTeachingModeTypeInList.RemoveAll(x => x.SpecialtyPlanID == specialtyPlanVerification.SpecialtyPlanID);
  3231. }
  3232. specialtyPlanTMDelList.Add(specialtyPlanVerification.SpecialtyPlanID);
  3233. foreach (var newModeType in newModeTypeList)
  3234. {
  3235. var newTeachingModeType = new EM_SpecialtyPlanTeachingModeType();
  3236. newTeachingModeType.SpecialtyPlanTeachingModeTypeID = Guid.NewGuid();
  3237. newTeachingModeType.SpecialtyPlanID = specialtyPlanVerification.SpecialtyPlanID;
  3238. newTeachingModeType.TeachingModeID = newModeType;
  3239. this.SetNewStatus(newTeachingModeType);
  3240. newTeachingModeTypeInList.Add(newTeachingModeType);
  3241. }
  3242. }
  3243. else
  3244. {
  3245. specialtyPlanTMDelList.Add(specialtyPlanVerification.SpecialtyPlanID);
  3246. }
  3247. if (newPlaceList != null && newPlaceList.Count() > 0)
  3248. {
  3249. if (newTeachingPlaceInList.Any(x => x.SpecialtyPlanID == specialtyPlanVerification.SpecialtyPlanID))
  3250. {
  3251. newTeachingPlaceInList.RemoveAll(x => x.SpecialtyPlanID == specialtyPlanVerification.SpecialtyPlanID);
  3252. }
  3253. specialtyPlanTPDelList.Add(specialtyPlanVerification.SpecialtyPlanID);
  3254. foreach (var newPlace in newPlaceList)
  3255. {
  3256. var newTeachingPlace = new EM_SpecialtyPlanTeachingPlace();
  3257. newTeachingPlace.SpecialtyPlanTeachingPlaceID = Guid.NewGuid();
  3258. newTeachingPlace.SpecialtyPlanID = specialtyPlanVerification.SpecialtyPlanID;
  3259. newTeachingPlace.TeachingPlace = newPlace;
  3260. this.SetNewStatus(newTeachingPlace);
  3261. newTeachingPlaceInList.Add(newTeachingPlace);
  3262. }
  3263. }
  3264. else
  3265. {
  3266. specialtyPlanTPDelList.Add(specialtyPlanVerification.SpecialtyPlanID);
  3267. }
  3268. upCount++;
  3269. }
  3270. }
  3271. using (TransactionScope ts = new TransactionScope())
  3272. {
  3273. //删除
  3274. UnitOfWork.Delete<EM_SpecialtyPlanTeachingPlace>(x => specialtyPlanTPDelList.Contains(x.SpecialtyPlanID));
  3275. UnitOfWork.Delete<EM_SpecialtyPlanTeachingModeType>(x => specialtyPlanTMDelList.Contains(x.SpecialtyPlanID));
  3276. //批量插入
  3277. UnitOfWork.BulkInsert(newSpecialtyPlanInList);
  3278. UnitOfWork.BulkInsert(newTeachingSettingInList);
  3279. UnitOfWork.BulkInsert(newTeachingModeTypeInList);
  3280. UnitOfWork.BulkInsert(newTeachingPlaceInList);
  3281. //批量统一提交更新
  3282. if (newSpecialtyPlanUpList != null && newSpecialtyPlanUpList.Count() > 0)
  3283. {
  3284. UnitOfWork.BatchUpdate(newSpecialtyPlanUpList);
  3285. }
  3286. //批量统一提交更新
  3287. if (newTeachingSettingUpList != null && newTeachingSettingUpList.Count() > 0)
  3288. {
  3289. UnitOfWork.BatchUpdate(newTeachingSettingUpList);
  3290. }
  3291. ts.Complete();
  3292. }
  3293. errdataList = errList.Distinct().ToList(); //错误列表List
  3294. }
  3295. catch (Exception)
  3296. {
  3297. throw;
  3298. }
  3299. }
  3300. }
  3301. }