|
|
|
@ -260,6 +260,14 @@ public class Ghre_OpenClassServices : BaseServices<Ghre_OpenClass, Ghre_OpenClas |
|
|
|
|
result.result.DT_TableDataT1[0].Schedules = await _ghre_OpenClassScheduleServices.QueryDto(x => x.OpenClassId == body.id); |
|
|
|
|
|
|
|
|
|
result.result.DT_TableDataT1[0].Attachments = await Db.Queryable<Ghre_Attachment>().Where(x => x.TableName == body.id.ObjToString() && x.AttachmentGroupID == 1).ToListAsync(); |
|
|
|
|
|
|
|
|
|
result.result.DT_TableDataT1[0].Attachments?.ForEach(x => |
|
|
|
|
{ |
|
|
|
|
x.FileURL = "Advanced/" + x.FileURL; |
|
|
|
|
x.PhysicsPath = "Advanced/" + x.PhysicsPath; |
|
|
|
|
x.RelativePath = "Advanced/" + x.RelativePath; |
|
|
|
|
x.ThumbnailPath = "Advanced/" + x.ThumbnailPath; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -534,6 +542,29 @@ public class Ghre_OpenClassServices : BaseServices<Ghre_OpenClass, Ghre_OpenClas |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "CancelOpening": |
|
|
|
|
var message = ""; |
|
|
|
|
var list2 = await Query(x => ids.Contains(x.Id)); |
|
|
|
|
for (int i = 0; i < list2.Count; i++) |
|
|
|
|
{ |
|
|
|
|
var entity = list2[i]; |
|
|
|
|
if (await Db.Queryable<Ghre_StudyRecord>() |
|
|
|
|
.Where(it => it.OpenClassId != null && it.OpenClassId == entity.Id && it.BeginTime != null) |
|
|
|
|
.AnyAsync()) |
|
|
|
|
return ServiceResult.OprateFailed($"开班【{entity.OpenClassName}】,已有人考试,暂不可取消开课!"); |
|
|
|
|
|
|
|
|
|
if (message.IsNullOrEmpty() && await Db.Queryable<Ghre_ExamRecord>() |
|
|
|
|
.Where(it => it.OpenClassId != null && it.OpenClassId == entity.Id && it.ActualBeginTime != null) |
|
|
|
|
.AnyAsync()) |
|
|
|
|
return ServiceResult.OprateFailed($"开班【{entity.OpenClassName}】,已有人考试,暂不可取消开课!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (message.IsNotEmptyOrNull()) |
|
|
|
|
throw new Exception(); |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
case "CancelPublished": |
|
|
|
|
|
|
|
|
|
var list1 = await Query(x => ids.Contains(x.Id)); |
|
|
|
@ -543,13 +574,14 @@ public class Ghre_OpenClassServices : BaseServices<Ghre_OpenClass, Ghre_OpenClas |
|
|
|
|
if (await Db.Queryable<Ghre_StudyRecord>() |
|
|
|
|
.Where(it => it.OpenClassId != null && it.OpenClassId == entity.Id && it.BeginTime != null) |
|
|
|
|
.AnyAsync()) |
|
|
|
|
throw new Exception($"开班【{entity.OpenClassName}】,已有人学习,暂不可取消发布!"); |
|
|
|
|
return ServiceResult.OprateFailed($"开班【{entity.OpenClassName}】,已有人学习,暂不可取消发布!"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (await Db.Queryable<Ghre_ExamRecord>() |
|
|
|
|
.Where(it => it.OpenClassId != null && it.OpenClassId == entity.Id && it.ActualBeginTime != null) |
|
|
|
|
.AnyAsync()) |
|
|
|
|
throw new Exception($"开班【{entity.OpenClassName}】,已有人考试,暂不可取消发布!"); |
|
|
|
|
return ServiceResult.OprateFailed($"开班【{entity.OpenClassName}】,已有人学习,暂不可取消发布!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
await Db.Deleteable<Ghre_StudyRecord>() |
|
|
|
|
.Where(it => it.OpenClassId != null && ids.Contains(it.OpenClassId.Value)) |
|
|
|
|