|
|
|
@ -444,13 +444,14 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt |
|
|
|
|
for (int j = 0; j < insertModel.baseData.courseID.Count; j++) |
|
|
|
|
{ |
|
|
|
|
var courseID = insertModel.baseData.courseID[j]; |
|
|
|
|
string sql = "SELECT * FROM Ghre_Question where QuestionType='{0}' and CourseId='{1}' and QuestionContent ='{2}'"; |
|
|
|
|
string sql = "SELECT * FROM Ghre_Question where QuestionType='{0}' and CourseId='{1}' and QuestionContent ='{2}' AND IsEnable =1"; |
|
|
|
|
sql = string.Format(sql, questionType.type, courseID, questionType.detail.content); |
|
|
|
|
DataTable dt = Db.Ado.GetDataTable(sql); |
|
|
|
|
if (dt.Rows.Count > 0) |
|
|
|
|
{ |
|
|
|
|
var course = await _ghre_CourseServices.QueryById(courseID); |
|
|
|
|
throw new Exception($"课程【{course.CourseName}】存在相同内容【{questionTypeName}】"); |
|
|
|
|
//var course = await _ghre_CourseServices.QueryById(courseID); |
|
|
|
|
//throw new Exception($"课程【{course.CourseName}】存在相同内容【{questionTypeName}】"); |
|
|
|
|
throw new Exception($"题库中存在相同题目"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
@ -536,13 +537,14 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt |
|
|
|
|
for (int j = 0; j < editModel.baseData.courseID.Count; j++) |
|
|
|
|
{ |
|
|
|
|
var courseID = editModel.baseData.courseID[j]; |
|
|
|
|
string sql = "SELECT * FROM Ghre_Question where QuestionType='{0}' and CourseId='{1}' and QuestionContent ='{2}' AND Id !='{3}'"; |
|
|
|
|
string sql = "SELECT * FROM Ghre_Question WHERE QuestionType='{0}' AND CourseId='{1}' AND QuestionContent ='{2}' AND Id !='{3}' AND IsEnable =1"; |
|
|
|
|
sql = string.Format(sql, questionType.type, courseID, questionType.detail.content, Id); |
|
|
|
|
DataTable dt = Db.Ado.GetDataTable(sql); |
|
|
|
|
if (dt.Rows.Count > 0) |
|
|
|
|
{ |
|
|
|
|
var course = await _ghre_CourseServices.QueryById(courseID); |
|
|
|
|
throw new Exception($"课程【{course.CourseName}】存在相同内容【{questionTypeName}】"); |
|
|
|
|
//var course = await _ghre_CourseServices.QueryById(courseID); |
|
|
|
|
//throw new Exception($"课程【{course.CourseName}】存在相同内容【{questionTypeName}】"); |
|
|
|
|
throw new Exception($"题库中存在相同题目"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
@ -852,6 +854,59 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt |
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++) |
|
|
|
|
{ |
|
|
|
|
var comments = new List<string>(); |
|
|
|
|
|
|
|
|
|
if (!dt.Columns.Contains("课程(必填)")) |
|
|
|
|
{ |
|
|
|
|
comments.Add("未查询到【课程(必填)】列!"); |
|
|
|
|
data.ErrorCount++; |
|
|
|
|
dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); |
|
|
|
|
isExistError = true; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!dt.Columns.Contains("题目内容(必填)")) |
|
|
|
|
{ |
|
|
|
|
comments.Add("未查询到【题目内容(必填)】列!"); |
|
|
|
|
data.ErrorCount++; |
|
|
|
|
dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); |
|
|
|
|
isExistError = true; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!dt.Columns.Contains("正确答案(必填)")) |
|
|
|
|
{ |
|
|
|
|
comments.Add("未查询到【正确答案(必填)】列!"); |
|
|
|
|
data.ErrorCount++; |
|
|
|
|
dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); |
|
|
|
|
isExistError = true; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!dt.Columns.Contains("课程(必填)")) |
|
|
|
|
{ |
|
|
|
|
comments.Add("未查询到【课程(必填)】列!"); |
|
|
|
|
data.ErrorCount++; |
|
|
|
|
dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); |
|
|
|
|
isExistError = true; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (!dt.Columns.Contains("解析")) |
|
|
|
|
{ |
|
|
|
|
comments.Add("未查询到【解析】列!"); |
|
|
|
|
data.ErrorCount++; |
|
|
|
|
dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); |
|
|
|
|
isExistError = true; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (!dt.Columns.Contains("难度")) |
|
|
|
|
{ |
|
|
|
|
comments.Add("未查询到【难度】列!"); |
|
|
|
|
data.ErrorCount++; |
|
|
|
|
dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); |
|
|
|
|
isExistError = true; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var courseName = dt.Rows[i]["课程(必填)"].ToString(); |
|
|
|
|
var questionContent = dt.Rows[i]["题目内容(必填)"].ToString(); |
|
|
|
|
var correctAnswer = string.Empty; |
|
|
|
@ -1028,7 +1083,7 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt |
|
|
|
|
data.SuccessCount++; |
|
|
|
|
id = await base.Add(insert); |
|
|
|
|
insertAnswers.ForEach(x => x.QuestionId = id); |
|
|
|
|
await _ghre_QuestionAnswerServices.Add(insertAnswers); |
|
|
|
|
//await _ghre_QuestionAnswerServices.Add(insertAnswers); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|