Browse Source

清空排课数据

临城职教中职
ndbs 2 years ago
parent
commit
4bee105743
3 changed files with 37 additions and 19 deletions
  1. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/EmptyByConditionForm.cshtml
  2. +6
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/EmptyByConditionForm.js
  3. +27
    -19
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs

+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/EmptyByConditionForm.cshtml View File

@@ -15,5 +15,9 @@
<div class="lr-form-item-title">学期<font face="宋体">*</font></div>
<div id="Semester" isvalid="yes" checkexpession="NotNull"></div>
</div>
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">同步内容<font face="宋体">*</font></div>
<div id="SyncType" isvalid="yes" checkexpession="NotNull"></div>
</div>
</div>
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/ArrangeLessonTerm/EmptyByConditionForm.js")

+ 6
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/EmptyByConditionForm.js View File

@@ -30,6 +30,12 @@ var bootstrap = function ($, learun) {
value: 'value',
text: 'text'
});
$('#SyncType').lrselect({
placeholder: "请选择同步内容",
data: [{ text: "课表", value: "1" }, { text: "开课计划", value: "2" }],
value: 'value',
text: 'text'
});
},
initData: function () {
//if (!!selectedRow) {


+ 27
- 19
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs View File

@@ -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;


Loading…
Cancel
Save