|
|
|
@ -201,7 +201,11 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
extend.styleInfo.paperStyle = exampaper.Style; |
|
|
|
|
extend.styleInfo.coverBackGround = exampaper.CoverBackGround; |
|
|
|
|
|
|
|
|
|
var questions = await Db.Queryable<Ghre_ExamPaperQuestion>().Where(x => x.ExamPaperId == exampaper.Id).ToListAsync(); |
|
|
|
|
var questions = await Db.Queryable<Ghre_ExamPaperQuestion>() |
|
|
|
|
//.Where(x => x.ExamPaperId == exampaper.Id) |
|
|
|
|
.Where(x => (x.ExamPaperId == exampaper.Id && exampaper.SetMethod == DIC_EXAM_PAPER_SET_METHOD.MANUAL) || (x.ExamPaperId == examRecordId && exampaper.SetMethod == DIC_EXAM_PAPER_SET_METHOD.RANDOM)) |
|
|
|
|
|
|
|
|
|
.ToListAsync(); |
|
|
|
|
var previews = questions.Where(x => x.QuestionId != null).Select(x => new DefaultGhre_ExamPaperPreview() |
|
|
|
|
{ |
|
|
|
|
Id = x.Id, |
|
|
|
@ -461,7 +465,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
extend.styleInfo.paperStyle = exampaper.Style; |
|
|
|
|
extend.styleInfo.coverBackGround = exampaper.CoverBackGround; |
|
|
|
|
|
|
|
|
|
if (exampaper.SetMethod == DIC_EXAM_PAPER_SET_METHOD.RANDOM) |
|
|
|
|
if (exampaper.SetMethod == DIC_EXAM_PAPER_SET_METHOD.RANDOM && record.Status != DIC_EXAM_RECORD_STATUS.EXAM_END) |
|
|
|
|
{ |
|
|
|
|
await Db.Deleteable<Ghre_ExamPaperQuestion>().Where(x => x.ExamPaperId == examRecordId).ExecuteCommandAsync(); |
|
|
|
|
var configs = await Db.Queryable<Ghre_ExamPaperConfig>().OrderBy(x => x.TaxisNo).Where(x => x.ExamPaperId == exampaper.Id).ToListAsync(); |
|
|
|
@ -488,6 +492,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
ExamPaperId = examRecordId, |
|
|
|
|
QuestionId = x.Id, |
|
|
|
|
ConfigId = x.Id, |
|
|
|
|
Score = config.Score |
|
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
Db.Insertable(insertExamPaperQuestions).ExecuteCommand(); |
|
|
|
@ -697,40 +702,63 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
CreateTime = DateTime.Now, |
|
|
|
|
ExamRecordDetailId = id, |
|
|
|
|
ExamRecordId = record.Id, |
|
|
|
|
QuestionAnswerId = questionAnswers1.First(x => x.QuestionNo == answer.value)?.Id, |
|
|
|
|
QuestionAnswerId = answer.value.IsNull() ? null : questionAnswers1.First(x => x.QuestionNo == answer.value)?.Id, |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
case "Multiple": |
|
|
|
|
var TaxisNo = 100; |
|
|
|
|
foreach (var value in answer.value1) |
|
|
|
|
{ |
|
|
|
|
if (answer.value1.IsNull() || (!answer.value1.IsNull() && !answer.value1.Any())) |
|
|
|
|
recordDetailAnswers.Add(new Ghre_ExamRecordAnswer() |
|
|
|
|
{ |
|
|
|
|
Id = SnowFlakeSingle.instance.getID(), |
|
|
|
|
CreateTime = DateTime.Now, |
|
|
|
|
ExamRecordDetailId = id, |
|
|
|
|
ExamRecordId = record.Id, |
|
|
|
|
QuestionAnswerId = questionAnswers1.First(x => x.QuestionNo == value)?.Id, |
|
|
|
|
AnswerContent = null, |
|
|
|
|
TaxisNo = TaxisNo |
|
|
|
|
}); |
|
|
|
|
TaxisNo += 100; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
foreach (var value in answer.value1) |
|
|
|
|
{ |
|
|
|
|
recordDetailAnswers.Add(new Ghre_ExamRecordAnswer() |
|
|
|
|
{ |
|
|
|
|
Id = SnowFlakeSingle.instance.getID(), |
|
|
|
|
CreateTime = DateTime.Now, |
|
|
|
|
ExamRecordDetailId = id, |
|
|
|
|
ExamRecordId = record.Id, |
|
|
|
|
QuestionAnswerId = value.IsNull() ? null : questionAnswers1.First(x => x.QuestionNo == value)?.Id, |
|
|
|
|
TaxisNo = TaxisNo |
|
|
|
|
}); |
|
|
|
|
TaxisNo += 100; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
case "Completion": |
|
|
|
|
var TaxisNo1 = 100; |
|
|
|
|
foreach (var value in answer.value1) |
|
|
|
|
{ |
|
|
|
|
if (answer.value1.IsNull() || (!answer.value1.IsNull() && !answer.value1.Any())) |
|
|
|
|
recordDetailAnswers.Add(new Ghre_ExamRecordAnswer() |
|
|
|
|
{ |
|
|
|
|
Id = SnowFlakeSingle.instance.getID(), |
|
|
|
|
CreateTime = DateTime.Now, |
|
|
|
|
ExamRecordDetailId = id, |
|
|
|
|
ExamRecordId = record.Id, |
|
|
|
|
AnswerContent = value, |
|
|
|
|
AnswerContent = null, |
|
|
|
|
TaxisNo = TaxisNo1 |
|
|
|
|
}); |
|
|
|
|
TaxisNo1 += 100; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
foreach (var value in answer.value1) |
|
|
|
|
{ |
|
|
|
|
recordDetailAnswers.Add(new Ghre_ExamRecordAnswer() |
|
|
|
|
{ |
|
|
|
|
Id = SnowFlakeSingle.instance.getID(), |
|
|
|
|
CreateTime = DateTime.Now, |
|
|
|
|
ExamRecordDetailId = id, |
|
|
|
|
ExamRecordId = record.Id, |
|
|
|
|
AnswerContent = value, |
|
|
|
|
TaxisNo = TaxisNo1 |
|
|
|
|
}); |
|
|
|
|
TaxisNo1 += 100; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case "ShortAnswer": |
|
|
|
|
recordDetailAnswers.Add(new Ghre_ExamRecordAnswer() |
|
|
|
|