using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Web.Http;
namespace Mvc.Controllers
{
public class CQMSPersonManageController : ApiController
{
///
/// 焊工列表
///
///
///
///
///
///
[HttpGet]
public ResponseData> WelderIndex(string projectId, int index, int page, string unitId)
{
ResponseData> res = new ResponseData>();
res.successful = true;
res.resultValue = BLL.SitePerson_PersonService.GetWelderListDataForApi(unitId, projectId, index, page);
return res;
}
///
/// 根据personId获取焊工详情
///
///
///
///
[HttpGet]
public ResponseData GetWelder(string projectId, string personId)
{
ResponseData res = new ResponseData();
Person_Persons welder = BLL.SitePerson_PersonService.GetWelder(projectId, personId);
res.successful = true;
res.resultValue = BeanUtil.CopyOjbect(welder, true);
return res;
}
///
/// 保存焊工
///
///
///
[HttpPost]
public ResponseData SaveWelder([FromBody] Model.SitePerson_Person Welder)
{
ResponseData res = new ResponseData();
try
{
BLL.SitePerson_PersonService.UpdateWelderForApi(Welder);
SaveAttachFile(Welder.SitePersonId, BLL.Const.WelderManageMenuId, Welder.RoleIds);
res.resultValue = Welder.PersonId;
res.successful = true;
}
catch (Exception e)
{
res.resultHint = e.StackTrace;
res.successful = false;
}
return res;
}
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);
}
}
}