コード例 #1
0
ファイル: MapController.cs プロジェクト: zpzpp/School.CSM
        /// <summary>
        /// 页面发送模拟报警至转发层
        /// </summary>
        /// <param name="alarmLevel"></param>
        /// <param name="deviceCode"></param>
        /// <param name="content"></param>
        /// <param name="eventCode"></param>
        /// <returns></returns>
        public JsonResult DeviceAlarm(string alarmName, int alarmLevel, string deviceCode, string content, string eventCode)
        {
            try
            {
                MapAlarmBLL mapAlarmBll = new MapAlarmBLL();
                #region 旧版
                //if (mapAlarmBll.AddDeviceAlarm(alarmName, alarmLevel, deviceCode, content, eventCode))
                //{
                //    return Json(new { status = 0, msg = "页面报警成功!" });
                //}
                //else
                //{
                //    return Json(new { status = 1, msg = "页面报警失败!" });
                //}
                #endregion

                #region 新版
                RetMsgModel retModel = mapAlarmBll.AddMapDeviceAlarm(alarmName, alarmLevel, deviceCode, content, eventCode);
                return(Json(new { status = retModel.status, msg = retModel.message }));

                #endregion
            }
            catch (Exception ex)
            {
                return(Json(new { status = 1, msg = ex.Message }));
            }
        }