コード例 #1
0
ファイル: YdMonitorAct.cs プロジェクト: ZQuanLi/Test
        /// <summary>
        /// 获取继电器历史状态
        /// </summary>
        /// <returns></returns>
        public APIRst YdMonitorOfGetIsRelay(int module_id)
        {
            APIRst rst = new APIRst();
            string DataValue = "", IsPaulKey = "";
            int    Status = 0;

            try
            {
                DataTable dt     = bll.GetYdMonitorOfGetIsRelay(module_id);
                int?      isPaul = null;
                if (dt.Rows.Count > 0)
                {
                    DataValue = CommFunc.ConvertDBNullToString(dt.Rows[0]["DataValue"]);
                    Status    = CommFunc.ConvertDBNullToInt32(dt.Rows[0]["Status"]);
                    IsPaulKey = CommFunc.ConvertDBNullToString(dt.Rows[0]["IsPaulKey"]);
                    if (dt.Rows[0]["IsPaul"] != DBNull.Value)
                    {
                        isPaul = CommFunc.ConvertDBNullToInt32(dt.Rows[0]["IsPaul"]);
                    }
                }
                // int? isPaul = null; = bll.GetYdMonitorOfGetIsPaul(module_id);
                if (!string.IsNullOrEmpty(IsPaulKey))
                {
                    YDS6000.WebApi.Areas.IFSMgr.Opertion.Monitor.MonitorHelper rd = new YDS6000.WebApi.Areas.IFSMgr.Opertion.Monitor.MonitorHelper();
                    APIRst objIsPaul = rd.GetRealVal(IsPaulKey);
                    if (objIsPaul != null && objIsPaul.rst == true)
                    {
                        //RstVar var = objIsPaul.data as RstVar;
                        object lpszVal = CommFunc.GetPropertyValue("lpszVal", objIsPaul.data);
                        if (lpszVal != null)
                        {
                            isPaul = (int)CommFunc.ConvertDBNullToDecimal(lpszVal);
                        }
                    }
                    else
                    {
                        isPaul = bll.GetYdMonitorOfGetIsPaul(module_id);
                    }
                }
                else
                {
                    isPaul = bll.GetYdMonitorOfGetIsPaul(module_id);
                }
                object obj = new { DataValue = DataValue, Status = Status, IsPaul = isPaul == null ? "" : isPaul.Value.ToString() };
                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取继电器状态列表错误 (YdMonitorOfGetIsRelay)", ex.Message + ex.StackTrace);
            }
            return(rst);
        }
コード例 #2
0
 public APIRst GetRealVal(string tag)
 {
     return(infoHelper.GetRealVal(tag));
 }