97 lines
3.0 KiB
C#
97 lines
3.0 KiB
C#
using BLL;
|
|
using Model.HSSE;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Security;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
|
|
namespace WebAPI.Controllers.HSSE
|
|
{
|
|
public class TrainTestRecordController : ApiController
|
|
{
|
|
|
|
#region 根据projectId获取培训考试列表
|
|
/// <summary>
|
|
/// 根据TestPlanId获取考生及试卷列表
|
|
/// </summary>
|
|
/// <param name="testPlanId"></param>
|
|
/// <returns>考试人员</returns>
|
|
public Model.ResponeData getTrainTestRecordListByProjectId(string projectId)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
responeData.data = APITrainTestRecordService.getTrainRecordListByProjectId(projectId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
return responeData;
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region 根据id获取培训考试
|
|
/// <summary>
|
|
/// 根据id获取培训考试
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns>培训考试</returns>
|
|
public Model.ResponeData getTrainTestRecordListById(string id)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
responeData.data = APITrainTestRecordService.getTrainRecordByTrainingId(id);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
return responeData;
|
|
}
|
|
#endregion
|
|
|
|
public static void SaveAttachFile(string dataId, string menuId, string url)
|
|
{
|
|
Model.ToDoItem toDoItem = new Model.ToDoItem
|
|
{
|
|
MenuId = menuId,
|
|
DataId = dataId,
|
|
UrlStr = url,
|
|
};
|
|
APIUpLoadFileService.SaveAttachUrl(toDoItem);
|
|
}
|
|
#region 添加取培训考试
|
|
/// <summary>
|
|
/// 添加取培训考试
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns>培训考试</returns>
|
|
[HttpPost]
|
|
public Model.ResponeData updateTrainRecord(TrainTestRecordItem item)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(item.TrainingTestRecordId))
|
|
item.TrainingTestRecordId = Guid.NewGuid().ToString();
|
|
APITrainTestRecordService.updateTrainRecord(item);
|
|
SaveAttachFile(item.TrainingTestRecordId + "r", BLL.Const.CheckListMenuId, item.AttachUrl1);
|
|
SaveAttachFile(item.TrainingTestRecordId + "re", BLL.Const.CheckListMenuId, item.AttachUrl2);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
return responeData;
|
|
}
|
|
#endregion
|
|
}
|
|
} |