|
|
@ -1687,6 +1687,42 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr |
|
|
|
await Db.Updateable(studyRecords).UpdateColumns(it => new { it.StudyStatus, it.RemarkSz }).ExecuteCommandAsync(); |
|
|
|
await Db.Updateable(studyRecords).UpdateColumns(it => new { it.StudyStatus, it.RemarkSz }).ExecuteCommandAsync(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Ghre_Courses = await Db.Queryable<Ghre_Course>().ToListAsync(); |
|
|
|
|
|
|
|
for (int i = 0; i < Ghre_Courses.Count; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#region 课程ID 同步至课件 |
|
|
|
|
|
|
|
if (!Ghre_Courses[i].CourseWareId.IsNull()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var wares = await Db.Queryable<Ghre_CourseWare>().Where(x => x.CourseIds.Contains(Ghre_Courses[i].Id.ToString()) && x.Id != Ghre_Courses[i].CourseWareId).ToListAsync(); |
|
|
|
|
|
|
|
for (int j = 0; j < wares.Count; j++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var courseIds2 = new List<long>(); |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(wares[j].CourseIds)) |
|
|
|
|
|
|
|
courseIds2 = JsonConvert.DeserializeObject<List<long>>(wares[j].CourseIds); |
|
|
|
|
|
|
|
courseIds2 = courseIds2.Where(x=>x!= Ghre_Courses[i].Id).ToList(); |
|
|
|
|
|
|
|
wares[j].CourseIds = JsonConvert.SerializeObject(courseIds2); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
await Db.Updateable(wares).UpdateColumns(it => new { it.CourseIds }).ExecuteCommandAsync(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ware = await Db.Queryable<Ghre_CourseWare>().FirstAsync(x => x.Id == Ghre_Courses[i].CourseWareId); |
|
|
|
|
|
|
|
if (ware != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var courseIds2 = new List<long>(); |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(ware.CourseIds)) |
|
|
|
|
|
|
|
courseIds2 = JsonConvert.DeserializeObject<List<long>>(ware.CourseIds); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!courseIds2.Any(x => x == Ghre_Courses[i].Id)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
courseIds2.Add(Ghre_Courses[i].Id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ware.CourseIds = JsonConvert.SerializeObject(courseIds2); |
|
|
|
|
|
|
|
await Db.Updateable<Ghre_CourseWare>().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
} |
|
|
|
return ServiceResult.OprateSuccess("执行成功!"); |
|
|
|
return ServiceResult.OprateSuccess("执行成功!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |