using System;
using System.Collections.Generic;
using System.Linq;
using BLL;
using System.Web.Http;

namespace WebApi.Controllers
{
    public class MessagePushController : ApiController
    {
        #region 推送的热处理委托单
        /// <summary>
        /// 推送的热处理委托单
        /// </summary>
        /// <param name="userId">登陆的用户ID</param>
        /// <returns></returns>
        public Model.ResponeData GetPushHotTrust(string userId)
        {
            var responeData = new Model.ResponeData();
            try
            {
                responeData.data =APIMessagePushService.GetPushHotTrust(userId);
            }
            catch (Exception ex)
            {
                responeData.code = 0;
                responeData.message = ex.Message;
            }

            return responeData;
        }
        #endregion

        #region 推送的NDE检测委托单
        /// <summary>
        /// 推送的NDE检测委托单
        /// </summary>
        /// <param name="userId">登陆的用户ID</param>
        /// <returns></returns>
        public Model.ResponeData GetPushNDTTrust(string userId)
        {
            var responeData = new Model.ResponeData();
            try
            {
                responeData.data = APIMessagePushService.GetPushNDTTrust(userId);
            }
            catch (Exception ex)
            {
                responeData.code = 0;
                responeData.message = ex.Message;
            }

            return responeData;
        }
        #endregion

        #region  焊工一次合格率低于96%预警
        /// <summary>
        /// 焊工一次合格率低于96%预警
        /// </summary>
        /// <param name="projectArea">项目区域</param>
        /// <returns></returns>
        public Model.ResponeData GetWelderOnePassRateWarning(string projectArea)
        {
            var responeData = new Model.ResponeData();
            try
            {
                responeData.data = APIMessagePushService.GetWelderOnePassRateWarning(projectArea);
            }
            catch (Exception ex)
            {
                responeData.code = 0;
                responeData.message = ex.Message;
            }

            return responeData;
        }
        #endregion

        #region  施工单位一次合格率低于96%预警
        /// <summary>
        /// 施工单位一次合格率低于96%预警
        /// </summary>
        /// <param name="projectArea">项目区域</param>
        /// <returns></returns>
        public Model.ResponeData GetUnitOnePassRateWarning(string projectArea)
        {
            var responeData = new Model.ResponeData();
            try
            {
                responeData.data = APIMessagePushService.GetUnitOnePassRateWarning(projectArea);
            }
            catch (Exception ex)
            {
                responeData.code = 0;
                responeData.message = ex.Message;
            }

            return responeData;
        }
        #endregion
    }
}