Explorar el Código

优化清空排课数据事务提交

新疆影视学院高职
liangkun hace 3 años
padre
commit
3ff1b47de1
Se han modificado 1 ficheros con 14 adiciones y 6 borrados
  1. +14
    -6
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs

+ 14
- 6
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs Ver fichero

@@ -1093,6 +1093,7 @@ WHERE (AcademicYearNo = '" + entity.AcademicYearNo + "') and semester='" + ent
public async Task<bool> 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<Root>(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;
}




Cargando…
Cancelar
Guardar