考试导出

This commit is contained in:
2023-06-27 21:09:40 +08:00
parent 4a1bd7a7b3
commit 48129fe367
3 changed files with 105 additions and 102 deletions
+28 -24
View File
@@ -1410,6 +1410,8 @@
var getTestRecord = TestRecordService.GetTestRecordById(testRecordId);
if (getTestRecord != null)
{
var sysTestRule = Funs.DB.Sys_TestRule.FirstOrDefault();
var getTestItems = from x in Funs.DB.Training_TestRecordItem
where x.TestRecordId == testRecordId
select x;
@@ -1465,11 +1467,11 @@
sb.Append("</table>");
sb.Append("<table width=\"100% \" cellspacing=\"0\" rules=\"all\" border=\"0\" style=\"border-collapse:collapse;font-size: 10.5pt;\">");
///单项选择题
sb.Append("<tr style=\"height: 30px\">");
sb.AppendFormat("<td align=\"left\" style=\"width:100%; font-weight: bold;\">{0}</td> ", "一、单项选择题 (每题2分,共50分)");
sb.Append("</tr>");
///单项选择题
var getSingleItem = getTestItems.Where(x=> x.TestType == "1").ToList();
sb.Append("<tr style=\"height: 30px\">");
sb.AppendFormat("<td align=\"left\" style=\"width:100%; font-weight: bold;\">{0}</td> ", "一、单项选择题 (每题"+ sysTestRule.SValue+ "分,共"+ (sysTestRule.SValue*getSingleItem.Count) + "分)");
sb.Append("</tr>");
if (getSingleItem.Count > 0)
{
int num = 1;
@@ -1478,7 +1480,7 @@
sb.Append("<tr style=\"height: 30px\">");
string Avstracts = item.Abstracts.Replace(" ", "").Replace(" ", "").Replace("", "(").Replace("", ")").Replace("()", "(" + item.SelectedItem + ")");
sb.AppendFormat("<td align=\"left\" style=\"width:100%;\">{0}</td> ", num + "、" + Avstracts);
sb.AppendFormat("<td align=\"left\" style=\"width:100%;\">{0}</td> ", num + "、" + Avstracts + " 正确答案:"+ item.AnswerItems);
sb.Append("</tr>");
sb.Append("<tr style=\"height: 30px\">");
string str = string.Empty;
@@ -1502,26 +1504,27 @@
sb.AppendFormat("<td align=\"left\" style=\"width:100%; \">{0}</td> ", str);
sb.Append("</tr>");
sb.Append("<tr style=\"height: 30px\">");
sb.AppendFormat("<td align=\"right\" style=\"width:100%; \">正确答案:{0}</td> ", item.AnswerItems);
sb.Append("</tr>");
//sb.Append("<tr style=\"height: 30px\">");
//sb.AppendFormat("<td align=\"right\" style=\"width:100%; \">正确答案:{0}</td> ", item.AnswerItems);
//sb.Append("</tr>");
num++;
}
}
///多项选择题
///多项选择题
var getMultipleItem = getTestItems.Where(x => x.TestType == "2").ToList();
sb.Append("<tr style=\"height: 30px\">");
sb.AppendFormat("<td align=\"left\" style=\"width: 100%; font-weight: bold; \">{0}</td> ", "二、多项选择题 (每题3分,共30分)");
sb.AppendFormat("<td align=\"left\" style=\"width: 100%; font-weight: bold; \">{0}</td> ", "二、多项选择题 (每题"+ sysTestRule.MValue+ "分,共"+(getMultipleItem.Count * getMultipleItem.Count) +"分)");
sb.Append("</tr>");
var getMultipleItem = getTestItems.Where(x => x.TestType == "2").ToList();
if (getMultipleItem.Count > 0)
{
int num = 1;
foreach (var item in getMultipleItem)
{
string Avstracts = item.Abstracts.Replace(" ", "").Replace(" ", "").Replace("", "(").Replace("", ")").Replace("()", "(" + item.SelectedItem + ")");
sb.AppendFormat("<td align=\"left\" style=\"width:100%; \">{0}</td> ", num + "、" + Avstracts);
sb.AppendFormat("<td align=\"left\" style=\"width:100%; \">{0}</td> ", num + "、" + Avstracts + " 正确答案:" + item.AnswerItems);
sb.Append("</tr>");
sb.Append("<tr style=\"height:30px\">");
string str = string.Empty;
@@ -1544,18 +1547,19 @@
sb.AppendFormat("<td align=\"left\" style=\"width: 100%; \">{0}</td> ", str);
sb.Append("</tr>");
sb.Append("<tr style=\"height: 30px\">");
sb.AppendFormat("<td align=\"right\" style=\"width:100%; \">正确答案:{0}</td> ", item.AnswerItems);
sb.Append("</tr>");
//sb.Append("<tr style=\"height: 30px\">");
//sb.AppendFormat("<td align=\"right\" style=\"width:100%; \">正确答案:{0}</td> ", item.AnswerItems);
//sb.Append("</tr>");
num++;
}
}
///判断题
sb.Append("<tr style=\"height: 30px\">");
sb.AppendFormat("<td align=\"left\" style=\"width: 100%; font-weight: bold;\">{0}</td> ", "三、判断题 (每题1分,共20分)");
sb.Append("</tr>");
///判断题
var getIsTrueItem = getTestItems.Where(x => x.TestType == "3").ToList();
sb.Append("<tr style=\"height: 30px\">");
sb.AppendFormat("<td align=\"left\" style=\"width: 100%; font-weight: bold;\">{0}</td> ", "三、判断题 (每题"+ sysTestRule.JValue + "分,共"+(sysTestRule.JValue+ getIsTrueItem.Count) + "分)");
sb.Append("</tr>");
if (getIsTrueItem.Count > 0)
{
int num = 1;
@@ -1572,11 +1576,11 @@
if (Avstracts.IndexOf("") > -1)
Avstracts = Avstracts.Replace("", "" + item.SelectedItem == "A" ? "(√" : "(×");
}
sb.AppendFormat("<td align=\"left\" style=\"width: 100%; \">{0}</td> ", num + "、" + Avstracts);
sb.Append("</tr>");
sb.Append("<tr style=\"height: 30px\">");
sb.AppendFormat("<td align=\"right\" style=\"width:100%; \">正确答案:{0}</td> ", item.AnswerItems== "=="? "√" : "×");
sb.Append("</tr>");
sb.AppendFormat("<td align=\"left\" style=\"width: 100%; \">{0}</td> ", num + "、" + Avstracts + "正确答案:"+ item.AnswerItems == "A" ? "√" : "×");
//sb.Append("</tr>");
//sb.Append("<tr style=\"height: 30px\">");
//sb.AppendFormat("<td align=\"right\" style=\"width:100%; \">正确答案:{0}</td> ", item.AnswerItems== "=="? "√" : "×");
//sb.Append("</tr>");
num++;
}
}