fix:考试
This commit is contained in:
@@ -429,5 +429,104 @@ namespace WebAPI.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 根据PersonId的岗位获取试卷
|
||||
|
||||
/// <summary>
|
||||
/// 根据PersonId的岗位获取试卷
|
||||
/// </summary>
|
||||
/// <param name="personId">人员ID</param>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getTestPlanRecordItemByPersonId(string personId, string projectId)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
var person = Funs.DB.View_SitePerson_Person.FirstOrDefault(x => x.PersonId == personId);
|
||||
if (person != null)
|
||||
{
|
||||
Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord
|
||||
{
|
||||
TestRecordId = SQLHelper.GetNewID(),
|
||||
ProjectId = projectId,
|
||||
TestManId = person.PersonId
|
||||
};
|
||||
TestRecordService.AddTestRecord(newTestRecord);
|
||||
|
||||
var testRecordId = CreateTestRecordItemNew(newTestRecord.TestRecordId, person);
|
||||
responeData.code = 1;
|
||||
responeData.data = new { testRecordId };
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
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
|
||||
where x.TrainingId == "99ccf4c8-6f8e-47da-a900-53b12a278f25" &&
|
||||
x.WorkPostNames.Contains(person.WorkPostName)
|
||||
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