From 3ff1b47de13056ba340b19e85f666cd6d1bbd0d6 Mon Sep 17 00:00:00 2001 From: liangkun Date: Fri, 17 Dec 2021 14:31:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B8=85=E7=A9=BA=E6=8E=92?= =?UTF-8?q?=E8=AF=BE=E6=95=B0=E6=8D=AE=E4=BA=8B=E5=8A=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ArrangeLessonTermService.cs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs index 15010c9bc..4b7916889 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs @@ -1093,6 +1093,7 @@ WHERE (AcademicYearNo = '" + entity.AcademicYearNo + "') and semester='" + ent public async Task AsyncModifyArrangeLessonDataByCondition(ArrangeLessonTermEntity entity) { bool result = false; + var db = BaseRepository("CollegeMIS"); try { if (entity.SyncType == "1") @@ -1106,23 +1107,30 @@ WHERE (AcademicYearNo = '" + entity.AcademicYearNo + "') and semester='" + ent var data = JsonConvert.DeserializeObject(apiData); if (data.success) { - await BaseRepository("CollegeMIS").ExecuteAsyncBySql( + db.BeginTrans(); + db.ExecuteBySql( $"delete from ArrangeLessonTerm where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); + db.Commit(); + result = true; } } } else { - await BaseRepository("CollegeMIS").ExecuteAsyncBySql( - $"delete from TeachClass where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); - await BaseRepository("CollegeMIS").ExecuteAsyncBySql( + db.BeginTrans(); + db.ExecuteBySql( + $"delete from TeachClass where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); + db.ExecuteBySql( $"delete from OpenLessonPlan where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); - await BaseRepository("CollegeMIS").ExecuteAsyncBySql( + db.ExecuteBySql( $"delete from StuSelectLessonList where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); + db.Commit(); + result = true; } } catch (Exception ex) { + db.Rollback(); if (ex is ExceptionEx) { throw; @@ -1132,7 +1140,7 @@ WHERE (AcademicYearNo = '" + entity.AcademicYearNo + "') and semester='" + ent throw ExceptionEx.ThrowServiceException(ex); } } - return true; + return result; }