|
|
@@ -1345,34 +1345,42 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest |
|
|
|
public async Task<bool> AsyncModifyArrangeLessonDataByCondition(ArrangeLessonTermEntity entity) |
|
|
|
{ |
|
|
|
bool result = false; |
|
|
|
var db = BaseRepository("CollegeMIS"); |
|
|
|
try |
|
|
|
{ |
|
|
|
HttpContent httpContent = new StringContent("{\"school\":\"" + entity.F_SchoolId + "\",\"year\":\"" + entity.AcademicYearNo + "\",\"number\":\"" + entity.Semester + "\"}"); |
|
|
|
httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); |
|
|
|
string apiData = await Client.PostAsync(Config.GetValue("ModifyArrangeLessonAPI"), httpContent).Result.Content.ReadAsStringAsync(); |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(apiData)) |
|
|
|
if (entity.SyncType == "1") |
|
|
|
{ |
|
|
|
var data = JsonConvert.DeserializeObject<Root>(apiData); |
|
|
|
if (data.success) |
|
|
|
db.BeginTrans(); |
|
|
|
db.ExecuteBySql( |
|
|
|
$"delete from ArrangeLessonTerm where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); |
|
|
|
db.Commit(); |
|
|
|
|
|
|
|
|
|
|
|
HttpContent httpContent = new StringContent("{\"school\":\"" + entity.F_SchoolId + "\",\"year\":\"" + entity.AcademicYearNo + "\",\"number\":\"" + entity.Semester + "\"}"); |
|
|
|
httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); |
|
|
|
string apiData = await Client.PostAsync(Config.GetValue("ModifyArrangeLessonAPI"), httpContent).Result.Content.ReadAsStringAsync(); |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(apiData)) |
|
|
|
{ |
|
|
|
var executeResult = await BaseRepository("CollegeMIS").ExecuteAsyncBySql( |
|
|
|
$"delete from ArrangeLessonTerm where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); |
|
|
|
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( |
|
|
|
$"delete from OpenLessonPlan where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); |
|
|
|
await BaseRepository("CollegeMIS").ExecuteAsyncBySql( |
|
|
|
$"delete from StuSelectLessonList where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); |
|
|
|
if (executeResult > 0) |
|
|
|
{ |
|
|
|
result = true; |
|
|
|
} |
|
|
|
result = true; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
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}' "); |
|
|
|
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; |
|
|
|