Преглед изворни кода

同步必修排课方法内去掉选修课的数据

西昌缴费二期
liangkun пре 2 година
родитељ
комит
7c7b05d948
1 измењених фајлова са 157 додато и 212 уклоњено
  1. +157
    -212
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs

+ 157
- 212
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs Прегледај датотеку

@@ -659,7 +659,7 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest
}
return result;
}
/// <summary>
/// 按条件同步排课数据
/// </summary>
@@ -674,169 +674,66 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest
var classroomData = (await BaseRepository("CollegeMIS").FindListAsync<ClassroomInfoEntity>()).ToList();
if (entity.SyncType == "1")
{
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("ArrangeLessonAPI"), httpContent).Result.Content.ReadAsStringAsync();

if (!string.IsNullOrEmpty(apiData))
var LessonList = BaseRepository("paikeDbString").FindList<paikeList>(
@"SELECT a.week AS 'week', a.section AS 'section',a.timetext AS 'timetext',c.name AS 'classname',c.number AS 'classnumber',
r.name AS 'roomname',r.number AS 'ClassroomNo',t.name AS 'teachername',t.number AS 'teacherNumber', cu.name AS 'curriculunName',
cu.number AS 'curriculunNumber', s.year AS 'year', s.number AS 'semester'
FROM tb_paike a
LEFT JOIN tb_clazz c ON c.id= a.`clazzid`
LEFT JOIN tb_classroom r ON r.id =a.`classroomid`
LEFT JOIN tb_teacher t ON t.id =a.`teacherid`
LEFT JOIN tb_curriculum cu ON cu.id=a.`curriculunid`
LEFT JOIN tb_semester s ON s.id=a.`semester`
WHERE 1=1 AND c.number IS NOT NULL AND s.year = '" + entity.AcademicYearNo + "' AND s.number ='" + entity.Semester + "'");

if (LessonList.Count() > 0)
{
var data = JsonConvert.DeserializeObject<RootByCondition>(apiData);
var dataList = data.entity.list;
if (dataList.Any())
var oldArrangeLessonTermList = (await BaseRepository("CollegeMIS").FindListAsync<ArrangeLessonTermEntity>()).ToList();
var insertDataList = new List<ArrangeLessonTermEntity>();
foreach (var item in LessonList)
{
var oldArrangeLessonTermList = (await BaseRepository("CollegeMIS").FindListAsync<ArrangeLessonTermEntity>()).ToList();
var insertDataList = new List<ArrangeLessonTermEntity>();
foreach (var item in dataList)
var classinfo = classData.FirstOrDefault(m => m.ClassNo == item.classnumber);
var timesArr = item.timetext.Substring(0, item.timetext.Length - 1).Split(',');
foreach (var timesItem in timesArr)
{
var classinfo = classData.FirstOrDefault(m => m.ClassId == item.clazzSid);

var timesArr = item.timeText.Substring(0, item.timeText.Length - 1).Split(',');
foreach (var timesItem in timesArr)
var insertData = new ArrangeLessonTermEntity
{
if (item.section.Contains(","))
{
foreach (var sec in item.section.Split(','))
{
var insertData = new ArrangeLessonTermEntity
{
ALTId = Guid.NewGuid().ToString(),
LessonDate = DateTime.Parse(timesItem),
AcademicYearNo = item.year,
Semester = item.number,
DeptNo = classinfo?.DeptNo,
MajorNo = classinfo?.MajorNo,
LessonNo = item.curriculunNumber,
LessonName = item.curriculunName,
TeachClassNo = item.curriculunName + classinfo?.ClassNo,
EmpNo = item.teacherNumber,
EmpName = item.teacherName,
LessonSortNo = lessonData.FirstOrDefault(m => m.LessonId == item.curriculunSid)?.LessonSortNo,
ClassroomNo = classroomData.FirstOrDefault(m => m.ClassroomId == item.classRoomSid)?.ClassroomNo,
LessonTime = item.week + sec,
CheckMark = "1",
F_SchoolId = item.schoolSid
};
if (oldArrangeLessonTermList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester
&& m.LessonNo == insertData.LessonNo && m.LessonDate == insertData.LessonDate
&& m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo
&& m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo
&& m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime
&& m.F_SchoolId == insertData.F_SchoolId) == 0
&& insertDataList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester
&& m.LessonNo == insertData.LessonNo && m.LessonDate == insertData.LessonDate
&& m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo
&& m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo
&& m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime
&& m.F_SchoolId == insertData.F_SchoolId) == 0)
{
insertDataList.Add(insertData);
}
//if (!oldArrangeLessonTermList.Any(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester
// && m.LessonNo == insertData.LessonNo && m.LessonDate == insertData.LessonDate
// && m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo
// && m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo
// && m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime
// && m.F_SchoolId == insertData.F_SchoolId)
// && !insertDataList.Any(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester
// && m.LessonNo == insertData.LessonNo && m.LessonDate == insertData.LessonDate
// && m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo
// && m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo
// && m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime
// && m.F_SchoolId == insertData.F_SchoolId))
//{
// insertDataList.Add(insertData);
//}
}
}
else
{
var insertData = new ArrangeLessonTermEntity
{
ALTId = Guid.NewGuid().ToString(),
LessonDate = DateTime.Parse(timesItem),
AcademicYearNo = item.year,
Semester = item.number,
DeptNo = classinfo?.DeptNo,
MajorNo = classinfo?.MajorNo,
LessonNo = item.curriculunNumber,
LessonName = item.curriculunName,
TeachClassNo = item.curriculunName + classinfo?.ClassNo,
EmpNo = item.teacherNumber,
EmpName = item.teacherName,
LessonSortNo = lessonData.FirstOrDefault(m => m.LessonId == item.curriculunSid)?.LessonSortNo,
ClassroomNo = classroomData.FirstOrDefault(m => m.ClassroomId == item.classRoomSid)?.ClassroomNo,
LessonTime = item.week + item.section,
CheckMark = "1",
F_SchoolId = item.schoolSid
};
if (oldArrangeLessonTermList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester
&& m.LessonNo == insertData.LessonNo && m.LessonDate == insertData.LessonDate
&& m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo
&& m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo
&& m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime
&& m.F_SchoolId == insertData.F_SchoolId) == 0
&& insertDataList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester
&& m.LessonNo == insertData.LessonNo && m.LessonDate == insertData.LessonDate
&& m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo
&& m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo
&& m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime
&& m.F_SchoolId == insertData.F_SchoolId) == 0)
{
insertDataList.Add(insertData);
}
}
ALTId = Guid.NewGuid().ToString(),
LessonDate = DateTime.Parse(timesItem),
AcademicYearNo = item.year,
Semester = item.semester,
DeptNo = classinfo?.DeptNo,
MajorNo = classinfo?.MajorNo,
LessonNo = item.curriculunNumber,
LessonName = item.curriculunName,
TeachClassNo = item.curriculunName + classinfo?.ClassNo,
EmpNo = item.teacherNumber,
EmpName = item.teachername,
LessonSortNo = lessonData.FirstOrDefault(m => m.LessonNo == item.curriculunNumber)?.LessonSortNo,
ClassroomNo = classroomData.FirstOrDefault(m => m.ClassroomNo == item.ClassroomNo)?.ClassroomNo,
LessonTime = item.week + item.section,
CheckMark = "1",
F_SchoolId = entity.F_SchoolId
};
if (oldArrangeLessonTermList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester
&& m.LessonNo == insertData.LessonNo && m.LessonDate.Value.Date == insertData.LessonDate.Value.Date
&& m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo
&& m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo
&& m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime
&& m.F_SchoolId == insertData.F_SchoolId) == 0
&& insertDataList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester
&& m.LessonNo == insertData.LessonNo && m.LessonDate.Value.Date == insertData.LessonDate.Value.Date
&& m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo
&& m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo
&& m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime
&& m.F_SchoolId == insertData.F_SchoolId) == 0)
{
insertDataList.Add(insertData);
BaseRepository("CollegeMIS").Insert(insertData);
}
}
await BaseRepository("CollegeMIS").InsertAsync(insertDataList);

//TeachClass数据处理
// var arrangeLessonTermData = (await BaseRepository("CollegeMIS").FindListAsync<ArrangeLessonTermEntity>(@"select F_SchoolId,AcademicYearNo,Semester,DeptNo,majorno,lessonno,replace(teachclassno,lessonname,'') as teachclassno,empno from [dbo].[ArrangeLessonTerm]
//where (AcademicYearNo = '" + stringAcademicYear + "') and semester='" + stringSemester + "' and F_SchoolId = '" + stringSchoolId + @"'
//group by F_SchoolId,AcademicYearNo,Semester,DeptNo,majorno,lessonno,replace(teachclassno,lessonname,'') ,empno ")).ToList();
// var TeachClassData = (await BaseRepository("CollegeMIS").FindListAsync<TeachClassEntity>(@"SELECT *
//FROM TeachClass
//WHERE (AcademicYearNo = '" + stringAcademicYear + "') and semester='" + stringSemester + "' and F_SchoolId='" + stringSchoolId + "' ")).ToList();
// var insertTeachClassDataList = new List<TeachClassEntity>();
// if (arrangeLessonTermData.Any())
// {
// foreach (var altitem in arrangeLessonTermData)
// {
// var insertTeachClassData = new TeachClassEntity()
// {
// AcademicYearNo = altitem.AcademicYearNo,
// Semester = altitem.Semester,
// DeptNo = altitem.DeptNo,
// MajorNo = altitem.MajorNo,
// LessonNo = altitem.LessonNo,
// Grade = classData.FirstOrDefault(m => m.ClassNo == altitem.TeachClassNo)?.Grade,
// LessonSortNo ="1",
// TeachClassNo = altitem.TeachClassNo,
// EmpNo = altitem.EmpNo,
// F_SchoolId = altitem.F_SchoolId
// };
// //非空判断
// if (TeachClassData.Count(m => m.AcademicYearNo == insertTeachClassData.AcademicYearNo &&
// m.Semester == insertTeachClassData.Semester && m.DeptNo == insertTeachClassData.DeptNo &&
// m.MajorNo == insertTeachClassData.MajorNo && m.LessonNo == insertTeachClassData.LessonNo &&
// m.Grade == insertTeachClassData.Grade && m.LessonSortNo == insertTeachClassData.LessonSortNo &&
// m.TeachClassNo == insertTeachClassData.TeachClassNo && m.EmpNo == insertTeachClassData.EmpNo &&
// m.F_SchoolId == insertTeachClassData.F_SchoolId) == 0
// && insertTeachClassDataList.Count(m => m.AcademicYearNo == insertTeachClassData.AcademicYearNo &&
// m.Semester == insertTeachClassData.Semester && m.DeptNo == insertTeachClassData.DeptNo &&
// m.MajorNo == insertTeachClassData.MajorNo && m.LessonNo == insertTeachClassData.LessonNo &&
// m.Grade == insertTeachClassData.Grade && m.LessonSortNo == insertTeachClassData.LessonSortNo &&
// m.TeachClassNo == insertTeachClassData.TeachClassNo && m.EmpNo == insertTeachClassData.EmpNo &&
// m.F_SchoolId == insertTeachClassData.F_SchoolId) == 0)
// {
// insertTeachClassDataList.Add(insertTeachClassData);
// }

// }
// await BaseRepository("CollegeMIS").InsertAsync(insertTeachClassDataList);
// }

}

}
}
else
@@ -861,7 +758,7 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest
LEFT JOIN tb_curriculum curriculum ON curriculum.id = a.curriculum
LEFT JOIN tb_classroom room ON room.id = a.classroom
LEFT JOIN tb_teacher teacher ON teacher.id = a.teacher
WHERE semester.year = '" + entity.AcademicYearNo + "' AND semester.number = '" + entity.Semester + "'");
WHERE a.type='1' and semester.year = '" + entity.AcademicYearNo + "' AND semester.number = '" + entity.Semester + "'");
var TeachClassData = (await BaseRepository("CollegeMIS").FindListAsync<TeachClassEntity>(@"SELECT *
FROM TeachClass
WHERE (AcademicYearNo = '" + entity.AcademicYearNo + "') and semester='" + entity.Semester + "' and F_SchoolId='" + entity.F_SchoolId + "' ")).ToList();
@@ -928,41 +825,64 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest
{
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("OpenLessonPlanAPI"), httpContent).Result.Content.ReadAsStringAsync();
var TeachList = BaseRepository("paikeDbString").FindList<TeachClassEntity>(
@"select m.name AS 'MajorName', m.number AS 'MajorNo', tt.EmpNo AS 'EmpNo',
tt.EmpName AS 'EmpName', sc.name AS 'F_SchoolName', sc.sid AS 'F_SchoolId',
p.grade AS 'Grade', p.classhour AS 'classhour', curr.name AS 'LessonName', curr.number AS 'LessonNo',
s.year AS 'AcademicYearNo', s.number AS 'Semester' FROM tb_major_plan p
LEFT JOIN (
SELECT
t.teacher,
GROUP_CONCAT(DISTINCT c.`name`) AS 'EmpName',
GROUP_CONCAT(DISTINCT c.number) AS 'EmpNo'
FROM
tb_major_plan t
LEFT JOIN tb_teacher c ON FIND_IN_SET(c.id, t.teacher) > 0
GROUP BY
t.teacher
) tt ON tt.teacher = p.teacher
LEFT JOIN tb_semester s ON s.id=p.`semester`
LEFT JOIN tb_school sc ON sc.`id`= p.`school`
LEFT JOIN tb_major m ON m.id=p.major
LEFT JOIN tb_course cour ON cour.id= p.`course`
LEFT JOIN tb_curriculum curr ON curr.id=cour.`course`
WHERE s.year = '" + entity.AcademicYearNo + "' AND s.number = '" + entity.Semester
+ "' AND sc.sid = '" + entity.F_SchoolId + "' AND curr.`ification` ='1' ORDER BY p.`major` ");

var majorData = (await BaseRepository("CollegeMIS").FindListAsync<CdMajorEntity>()).ToList();
var lessonData = (await BaseRepository("CollegeMIS").FindListAsync<LessonInfoEntity>()).ToList();
if (!string.IsNullOrEmpty(apiData))

if (TeachList.Count() > 0)
{
var data = JsonConvert.DeserializeObject<RootOfPlanByCondition>(apiData);
var dataList = data.entity.list;
var openLessonPlanData = await BaseRepository("CollegeMIS").FindListAsync<OpenLessonPlanEntity>();
if (dataList.Any())
var now = DateTime.Now;
var insertDataList = new List<OpenLessonPlanEntity>();

foreach (var item in TeachList)
{
var insertDataList = new List<OpenLessonPlanEntity>();
var now = DateTime.Now;
foreach (var item in dataList)
foreach (var itemTeach in item.EmpNo.Split(','))
{
var insertData = new OpenLessonPlanEntity()
{
TeachNo = itemTeach,
MakeDate = now,
AcademicYearNo = item.semester.year,
Semester = item.semester.number,
DeptNo = majorData.FirstOrDefault(m => m.ID == item.major.sid)?.DeptNo,
MajorNo = item.major.number,
LessonNo = item.course.course.number,
LessonName = item.course.course.name,
AcademicYearNo = item.AcademicYearNo,
Semester = item.Semester,
DeptNo = majorData.FirstOrDefault(m => m.MajorNo == item.MajorNo)?.DeptNo,
MajorNo = item.MajorNo,
LessonNo = item.LessonNo,
LessonName = item.LessonName,
PartCode = "",
Grade = item.grade,
LessonSortNo = lessonData.FirstOrDefault(m => m.LessonNo == item.course.course.number)?.LessonSortNo,
LessonSortDetailNo = lessonData.FirstOrDefault(m => m.LessonNo == item.course.course.number)?.LessonSortDetailNo,
StartWeek = item.semester.yesNo,
EndWeek = item.semester.week,
Grade = item.Grade,
LessonSortNo = lessonData.FirstOrDefault(m => m.LessonNo == item.LessonSortNo)
?.LessonSortNo,
LessonSortDetailNo = lessonData
.FirstOrDefault(m => m.LessonNo == item.LessonSortDetailNo)?.LessonSortDetailNo,
StartWeek = item.StartWeek,
EndWeek = item.EndWeek,
CheckStyleNo = "1",
ScoreRecordStyleNo = "1",
TeachDeptNo = majorData.FirstOrDefault(m => m.ID == item.major.sid)?.DeptNo,
TeachDeptNo = majorData.FirstOrDefault(m => m.MajorNo == item.MajorNo)?.DeptNo,
StudyScore = 0,
AmendDate = now,
ClassroomType = 1,
@@ -970,36 +890,35 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest
CheckMarkDept = "1",
CheckMark = "1",
TestMark = 0,
F_SchoolId = item.school.sid
F_SchoolId = item.F_SchoolId
};
if (openLessonPlanData.Count(m => m.AcademicYearNo == insertData.AcademicYearNo &&
m.Semester == insertData.Semester &&
m.DeptNo == insertData.DeptNo &&
m.MajorNo == insertData.MajorNo &&
m.LessonNo == insertData.LessonNo &&
m.Grade == insertData.Grade &&
m.LessonSortNo == insertData.LessonSortNo &&
m.LessonName == insertData.LessonName &&
m.F_SchoolId == insertData.F_SchoolId) == 0 && insertDataList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo &&
m.Semester == insertData.Semester &&
m.DeptNo == insertData.DeptNo &&
m.MajorNo == insertData.MajorNo &&
m.LessonNo == insertData.LessonNo &&
m.Grade == insertData.Grade &&
m.LessonSortNo == insertData.LessonSortNo &&
m.LessonName == insertData.LessonName &&
m.F_SchoolId == insertData.F_SchoolId) == 0)
m.F_SchoolId == insertData.F_SchoolId) == 0 &&
insertDataList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo &&
m.Semester == insertData.Semester &&
m.MajorNo == insertData.MajorNo &&
m.LessonNo == insertData.LessonNo &&
m.Grade == insertData.Grade &&
m.LessonSortNo == insertData.LessonSortNo &&
m.LessonName == insertData.LessonName &&
m.F_SchoolId == insertData.F_SchoolId) == 0)
{
insertDataList.Add(insertData);
}
}
await BaseRepository("CollegeMIS").InsertAsync(insertDataList);
}
await BaseRepository("CollegeMIS").InsertAsync(insertDataList);
}
//学生选课数据
var TeachClassData = (await BaseRepository("CollegeMIS").FindListAsync<TeachClassEntity>(@"SELECT *
FROM TeachClass
WHERE (AcademicYearNo = '" + entity.AcademicYearNo + "') and semester='" + entity.Semester + "' and F_SchoolId='" + entity.F_SchoolId + "' ")).ToList();
FROM TeachClass
WHERE (AcademicYearNo = '" + entity.AcademicYearNo + "') and semester='" + entity.Semester + "' and F_SchoolId='" + entity.F_SchoolId + "' ")).ToList();
var stuinfobasicData = (await BaseRepository("CollegeMIS").FindListAsync<StuInfoBasicEntity>()).ToList();
var stuSelectLessonListEntityData = (await BaseRepository("CollegeMIS").FindListAsync<StuSelectLessonListEntity>()).ToList();
var insertStuSelectLessonListDataList = new List<StuSelectLessonListEntity>();
@@ -1093,34 +1012,44 @@ WHERE (AcademicYearNo = '" + entity.AcademicYearNo + "') and semester='" + ent
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)
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)
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();
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;
@@ -2741,7 +2670,23 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les

#endregion


public class paikeList
{
public string week { get; set; }
public string section { get; set; }
public string timetext { get; set; }
public string classname { get; set; }
public string classnumber { get; set; }
public string roomname { get; set; }
public string ClassroomNo { get; set; }
public string teachername { get; set; }
public string teacherNumber { get; set; }
public string curriculunName { get; set; }
public string curriculunNumber { get; set; }
public string year { get; set; }
public string semester { get; set; }
public string schoolno { get; set; }
}
#endregion
}



Loading…
Откажи
Сачувај