Compare commits
No commits in common. "1747f162cadcf445c21cc51ed3d37cb7979332f6" and "0be8cc170ffd466c2640afb925abb37898755ffc" have entirely different histories.
1747f162ca
...
0be8cc170f
@ -522,14 +522,6 @@ namespace APT.SE.WebApi.Controllers.Api
|
||||
List<string> listPointNameEmpty = new List<string>();
|
||||
DateTime dtNow = DateTime.Now;
|
||||
|
||||
//数据库现有题目 去重判断
|
||||
List<T_SE_TEST> listDataAllCheck = GetEntities<T_SE_TEST>(e => !e.IS_DELETED, null, null).ToList();
|
||||
T_SE_TEST check = null;
|
||||
List<string> listRepeatDataIndex = new List<string>();
|
||||
List<string> listNameTypeError = new List<string>();
|
||||
List<string> listRepeatExcelIndex = new List<string>();
|
||||
List<string> listNameTypeEError = new List<string>();
|
||||
|
||||
for (int i = 0; i < rowAll; i++)
|
||||
{
|
||||
#region 不能为空
|
||||
@ -570,15 +562,15 @@ namespace APT.SE.WebApi.Controllers.Api
|
||||
var testType = dtSource.Rows[i][1].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(testType))
|
||||
{
|
||||
if (testType == "是非题")
|
||||
if (dtSource.Rows[i][1].ToString().Trim() == "是非题")
|
||||
{
|
||||
mainTable.TYPE = SETestTypeEnum.是非题;
|
||||
}
|
||||
else if (testType == "单选题")
|
||||
else if (dtSource.Rows[i][1].ToString().Trim() == "单选题")
|
||||
{
|
||||
mainTable.TYPE = SETestTypeEnum.单选题;
|
||||
}
|
||||
else if (testType == "多选题")
|
||||
else if (dtSource.Rows[i][1].ToString().Trim() == "多选题")
|
||||
{
|
||||
mainTable.TYPE = SETestTypeEnum.多选题;
|
||||
}
|
||||
@ -591,20 +583,6 @@ namespace APT.SE.WebApi.Controllers.Api
|
||||
{
|
||||
throw new Exception("题型不能为空!");
|
||||
}
|
||||
|
||||
check = listDataAllCheck.FirstOrDefault(e => e.NAME == mainTable.NAME && e.TYPE == mainTable.TYPE);
|
||||
if (check != null)
|
||||
{
|
||||
listRepeatDataIndex.Add((i + rowIndex).ToString());
|
||||
listNameTypeError.Add(mainTable.NAME + "" + testType);
|
||||
}
|
||||
check = mainTables.FirstOrDefault(e => e.NAME == mainTable.NAME && e.TYPE == mainTable.TYPE);
|
||||
if (check != null)
|
||||
{
|
||||
listRepeatExcelIndex.Add((i + rowIndex).ToString());
|
||||
listNameTypeEError.Add(mainTable.NAME + "" + testType);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(dtSource.Rows[i][2].ToString().Trim()))
|
||||
{
|
||||
mainTable.OPTION_A = (dtSource.Rows[i][2].ToString().Trim());
|
||||
@ -631,11 +609,11 @@ namespace APT.SE.WebApi.Controllers.Api
|
||||
mainTable.ANSWERSHOW = strANSWER;
|
||||
if (mainTable.TYPE == SETestTypeEnum.是非题)
|
||||
{
|
||||
if (strANSWER == "A" || strANSWER == "是" || strANSWER == "a")
|
||||
if (strANSWER == "是" || strANSWER == "A")
|
||||
{
|
||||
mainTable.ANSWER = 1;
|
||||
}
|
||||
else if (strANSWER == "B" || strANSWER == "否" || strANSWER == "b")
|
||||
else if (strANSWER == "否" || strANSWER == "B")
|
||||
{
|
||||
mainTable.ANSWER = 2;
|
||||
}
|
||||
@ -648,7 +626,8 @@ namespace APT.SE.WebApi.Controllers.Api
|
||||
listAnswerErrorIndex.Add((i + rowIndex).ToString());
|
||||
}
|
||||
}
|
||||
else if (mainTable.TYPE == SETestTypeEnum.单选题)
|
||||
|
||||
if (mainTable.TYPE == SETestTypeEnum.单选题)
|
||||
{
|
||||
if (strANSWER == "A")
|
||||
{
|
||||
@ -675,7 +654,7 @@ namespace APT.SE.WebApi.Controllers.Api
|
||||
listAnswerErrorIndex.Add((i + rowIndex).ToString());
|
||||
}
|
||||
}
|
||||
else if (mainTable.TYPE == SETestTypeEnum.多选题)
|
||||
if (mainTable.TYPE == SETestTypeEnum.多选题)
|
||||
{
|
||||
int answer = 0;
|
||||
if (strANSWER.Contains("A"))
|
||||
@ -830,7 +809,7 @@ namespace APT.SE.WebApi.Controllers.Api
|
||||
#region 提示
|
||||
|
||||
string strEmptyError = string.Empty;
|
||||
if (listPostNameEmpty.Count > 0 || dicIndexEmpty.Count > 0 || listPointNameEmpty.Count > 0 || listRepeatDataIndex.Count > 0 || listRepeatExcelIndex.Count > 0)
|
||||
if (listPostNameEmpty.Count > 0 || dicIndexEmpty.Count > 0 || listPointNameEmpty.Count > 0)
|
||||
{
|
||||
if (dicIndexEmpty.Count > 0)
|
||||
{
|
||||
@ -861,14 +840,6 @@ namespace APT.SE.WebApi.Controllers.Api
|
||||
{
|
||||
throw new Exception("答案有误,行:【" + string.Join(",", listAnswerErrorIndex) + "】值:" + string.Join(",", listAnswerError));
|
||||
}
|
||||
if (listRepeatDataIndex.Count > 0)
|
||||
{
|
||||
throw new Exception("与现有题库重复,行:【" + string.Join(",", listRepeatDataIndex) + "】值:" + string.Join(",", listNameTypeError));
|
||||
}
|
||||
if (listRepeatExcelIndex.Count > 0)
|
||||
{
|
||||
throw new Exception("Excel中题目重复,行:【" + string.Join(",", listRepeatExcelIndex) + "】值:" + string.Join(",", listNameTypeEError));
|
||||
}
|
||||
}
|
||||
if (strEmptyError != string.Empty)
|
||||
throw new Exception(strEmptyError);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user