1
This commit is contained in:
@@ -691,22 +691,42 @@ namespace WebAPI.Controllers
|
||||
int getPassScores = 70;
|
||||
if (getTestScores < getPassScores)
|
||||
{
|
||||
int testCount = db.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count();
|
||||
if (testCount < 2)
|
||||
// int testCount = db.Training_TestRecord.Where(x => x.ProjectId == getTestRecord.ProjectId && x.TestManId == getTestRecord.TestManId).Count();
|
||||
// if (testCount < 2)
|
||||
// {
|
||||
////重新生成一条考试记录 以及考试试卷
|
||||
// returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord);
|
||||
Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord
|
||||
{
|
||||
////重新生成一条考试记录 以及考试试卷
|
||||
returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord);
|
||||
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,您将进入补考。";
|
||||
}
|
||||
else
|
||||
TestRecordId = SQLHelper.GetNewID(),
|
||||
ProjectId = getTestRecord.ProjectId,
|
||||
TestManId = getTestRecord.TestManId,
|
||||
TestType = getTestRecord.TestType,
|
||||
TemporaryUser = getTestRecord.TemporaryUser,
|
||||
Duration = getTestRecord.Duration,
|
||||
};
|
||||
|
||||
Funs.DB.Training_TestRecord.InsertOnSubmit(newTestRecord);
|
||||
Funs.DB.SubmitChanges();
|
||||
|
||||
var person =
|
||||
Funs.DB.View_SitePerson_Person.FirstOrDefault(
|
||||
x => x.PersonId == newTestRecord.TestManId);
|
||||
if (person != null)
|
||||
{
|
||||
// APITestRecordService.updateAll(getTestRecord.TestPlanId);
|
||||
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
|
||||
CreateTestRecordItemNew(newTestRecord.TestRecordId, person);
|
||||
}
|
||||
|
||||
returnTestRecordId = newTestRecord.TestRecordId;
|
||||
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,您将进入补考。";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
// APITestRecordService.updateAll(getTestRecord.TestPlanId);
|
||||
responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
|
||||
}
|
||||
|
||||
@@ -723,6 +743,65 @@ namespace WebAPI.Controllers
|
||||
return responeData;
|
||||
}
|
||||
|
||||
|
||||
public static string CreateTestRecordItemNew(string testRecordId, Model.View_SitePerson_Person person)
|
||||
{
|
||||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||||
{
|
||||
var getTestTrainingItemList = (from x in Funs.DB.Training_TestTrainingItem
|
||||
join y in Funs.DB.Training_TestTraining on x.TrainingId equals y.TrainingId
|
||||
where y.TrainingName.Contains("岗位人员试题") &&
|
||||
x.WorkPostIds.Contains(person.WorkPostId)
|
||||
orderby x.TestType, x.TrainingItemCode
|
||||
select new
|
||||
{
|
||||
x.TrainingItemId,
|
||||
x.TrainingId,
|
||||
x.TrainingItemName,
|
||||
x.TrainingItemCode,
|
||||
x.Abstracts,
|
||||
x.AttachUrl,
|
||||
x.TestType,
|
||||
x.WorkPostIds,
|
||||
x.WorkPostNames,
|
||||
x.AItem,
|
||||
x.BItem,
|
||||
x.CItem,
|
||||
x.DItem,
|
||||
x.EItem,
|
||||
x.AnswerItems,
|
||||
x.Score
|
||||
}).ToList();
|
||||
|
||||
|
||||
if (getTestTrainingItemList.Count() > 0)
|
||||
{
|
||||
var getItems = from x in getTestTrainingItemList
|
||||
select new Model.Training_TestRecordItem
|
||||
{
|
||||
TestRecordItemId = SQLHelper.GetNewID(),
|
||||
TestRecordId = testRecordId,
|
||||
TrainingItemName = x.TrainingItemName,
|
||||
TrainingItemCode = x.TrainingItemCode,
|
||||
Abstracts = x.Abstracts,
|
||||
AttachUrl = x.AttachUrl,
|
||||
TestType = x.TestType,
|
||||
AItem = x.AItem,
|
||||
BItem = x.BItem,
|
||||
CItem = x.CItem,
|
||||
DItem = x.DItem,
|
||||
EItem = x.EItem,
|
||||
AnswerItems = x.AnswerItems,
|
||||
Score = x.Score,
|
||||
};
|
||||
|
||||
db.Training_TestRecordItem.InsertAllOnSubmit(getItems);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
return testRecordId;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user