From 212cefc32672599fd4f03c3a9b3bd87623f9af76 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Fri, 21 Oct 2022 11:41:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E4=BF=AE=E8=AF=BE=E7=A8=8B=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OpenLessonPlanOfElective/MergeIndex.js | 1 - .../OpenLessonPlanOfElectiveService.cs | 30 +++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/MergeIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/MergeIndex.js index fb754313c..761e5fe4e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/MergeIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/MergeIndex.js @@ -263,7 +263,6 @@ var bootstrap = function ($, learun) { } }); console.log(keyValue); - return; learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/DeleteElective', { keyValue: keyValue }, function () { refreshGirdData(); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveService.cs index 896c34ea3..f2c6b7315 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveService.cs @@ -407,8 +407,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// public void DeleteElective(string keyValue) { + var db = this.BaseRepository("CollegeMIS"); try { + db.BeginTrans(); /* * ElectiveMajor [dbo].[OpenLessonPlanOfElective] @@ -421,16 +423,38 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration keyValue = string.Join("','", keyValue.Split(',')); } - var list = this.BaseRepository("CollegeMIS").FindList($"select * from OpenLessonPlanOfElective where Id in ('{keyValue}')"); + var list = db.FindList($"select * from OpenLessonPlanOfElective where Id in ('{keyValue}')"); foreach (var entity in list) { - + var lessonSectionArr = entity.LessonSection.Split(','); + var lessonTimeArr = entity.LessonTime.Split(','); + //选修课课程异动 + db.ExecuteBySql($"delete from OpenLessonPlanOfElectiveChange where OLPEId='{entity.Id}'"); + + for (int i = 0; i < lessonSectionArr.Length; i++) + { + //合班历史记录 + db.ExecuteBySql( + $@"delete from OpenLessonPlanOfElectiveDel where AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' and LessonNo='{entity.LessonNo}' + and empno = '{entity.EmpNo}' and ClassRoomNo = '{entity.ClassRoomNo}' + and LessonTime = '{lessonTimeArr[i]}' and LessonSection = '{lessonSectionArr[i]}'"); + //选修课排课 + db.ExecuteBySql( + $@"delete from ArrangeLessonTermOfElective where AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' and LessonNo='{entity.LessonNo}' + and empno = '{entity.EmpNo}' and ClassRoomNo = '{entity.ClassRoomNo}' + and LessonTime = '{lessonTimeArr[i]}' and LessonSection = '{lessonSectionArr[i]}'"); + } + //选课专业 + db.ExecuteBySql($"delete from ElectiveMajor where OLPEId='{entity.Id}'"); + //删除选修课课程表 + db.ExecuteBySql($"delete from OpenLessonPlanOfElective where Id='{entity.Id}'"); } - + db.Commit(); } catch (Exception ex) { + db.Rollback(); if (ex is ExceptionEx) { throw;