修改作业票
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using BLL;
|
||||
using Mvc.Controllers;
|
||||
|
||||
namespace WebAPI.Controllers.HSSE
|
||||
{
|
||||
public class HSSELogController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
/// 加载日志列表
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getHSSELogDataList( string projectId, string userId, int pageIndex=0)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
var getDataList = HSSELogService.getHSSELogDataList(projectId, userId);
|
||||
int pageCount = getDataList.Count;
|
||||
if (pageCount > 0 && pageIndex > 0)
|
||||
{
|
||||
getDataList = (from x in getDataList.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize)
|
||||
select x).ToList();
|
||||
}
|
||||
responeData.data = new { pageCount, getDataList };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载日志列表
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getHSSELogData(string HSSELogId)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
responeData.data = HSSELogService.getHSSELogData(HSSELogId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载天气
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getWeatherDataList()
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
responeData.data = ConstValue.drpConstItemList(BLL.ConstValue.Group_Weather);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存日志
|
||||
/// </summary>
|
||||
/// <param name="licenseDataItem">作业票记录</param>
|
||||
[HttpPost]
|
||||
public Model.ResponeData SaveHSSELogData([FromBody] Model.Manager_HSSELog HSSELog)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
HSSELog.IsVisible = true;
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(HSSELog.HSSELogId))
|
||||
{
|
||||
BLL.HSSELogService.UpdateHSSELog(HSSELog);
|
||||
responeData.message = "修改成功";
|
||||
}
|
||||
else
|
||||
{
|
||||
HSSELog.HSSELogId = SQLHelper.GetNewID(typeof(Model.Manager_HSSELog));
|
||||
BLL.HSSELogService.AddHSSELog(HSSELog);
|
||||
responeData.message = "保存成功";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
ErrLogInfo.WriteLog(string.Empty, ex);
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user