Esempio n. 1
0
        private bool getIsInTime(List <DateTime> L1, List <DateTime> L2)
        {
            PlatformAlarmRegionAlarm platformAlarmRegionAlarm = new PlatformAlarmRegionAlarm();
            DateTime svrTime = ReadDataFromDB.GetSvrTime();

            for (int i = 0; i < L1.Count; i++)
            {
                if (platformAlarmRegionAlarm.IsInConfigTime(L1[i], L2[i], svrTime))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 2
0
 private void tCheckPathAlarm_Elapsed(object sender, ElapsedEventArgs e)
 {
     this.tCheckPathAlarm.Enabled = false;
     try
     {
         try
         {
             PlatformAlarmRegionAlarm platformAlarmRegionAlarm = new PlatformAlarmRegionAlarm();
             this.clearAlarmCar();
             this.dtConfigInfo = this.getConfigInfo();
             if (this.dtConfigInfo != null && this.dtConfigInfo.Rows.Count > 0)
             {
                 foreach (DataRow row in this.dtConfigInfo.Rows)
                 {
                     DateTime dateTime = Convert.ToDateTime(row["BeginTime"]);
                     DateTime dateTime1 = Convert.ToDateTime(row["EndTime"]);
                     DateTime dateTime2 = Convert.ToDateTime(row["gpsTime"]);
                     if (!platformAlarmRegionAlarm.IsInConfigTime(dateTime, dateTime1, this.dtNow) || !platformAlarmRegionAlarm.IsInConfigTime(dateTime, dateTime1, dateTime2) || dateTime2.Date != this.dtNow.Date)
                     {
                         continue;
                     }
                     int num = Convert.ToInt32(row["carid"]);
                     int num1 = Convert.ToInt32(row["PathID"]);
                     if (this.htCarPathInfo[num] == null)
                     {
                         this.htCarPathInfo[num] = "";
                     }
                     try
                     {
                         if (this.htAlarmList[num] != null)
                         {
                             this.htAlarmList[num] = (this.htAlarmList[num] as AlarmCarInfo).updateAlarmCar(num, num1, dateTime, dateTime1);
                         }
                         else
                         {
                             this.htAlarmList[num] = AlarmCarInfo.getAlarmCar(num, num1, dateTime, dateTime1);
                         }
                     }
                     catch (Exception exception1)
                     {
                         Exception exception = exception1;
                         ErrorMsg errorMsg = new ErrorMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", string.Concat("保存报警车辆信息,", exception.Message));
                         this.logHelper.WriteError(errorMsg);
                     }
                     if (row["Longitude"] == DBNull.Value || row["Latitude"] == DBNull.Value || double.Parse(row["Longitude"].ToString()) < 0.001 || double.Parse(row["Latitude"].ToString()) < 0.001)
                     {
                         if (this.htCarPathInfo.Contains(num))
                         {
                             this.htCarPathInfo.Remove(num);
                         }
                         LogMsg logMsg = new LogMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", "");
                         object[] str = new object[] { "carid:", num, ",pathId:", num1.ToString(), ",simnum:", row["simnum"].ToString(), ",轨迹不存在或为0" };
                         logMsg.Msg = string.Concat(str);
                         this.logHelper.WriteLog(logMsg);
                     }
                     else if (row["alarmpathdot"] == DBNull.Value || string.IsNullOrEmpty(row["alarmpathdot"].ToString()))
                     {
                         if (this.htCarPathInfo.Contains(num))
                         {
                             this.htCarPathInfo.Remove(num);
                         }
                         LogMsg logMsg1 = new LogMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", "");
                         object[] objArray = new object[] { "carid:", num, ",pathId:", num1.ToString(), ",simnum:", row["simnum"].ToString(), ",路线不存在" };
                         logMsg1.Msg = string.Concat(objArray);
                         this.logHelper.WriteLog(logMsg1);
                     }
                     else
                     {
                         Hashtable hashtables = this.htCarPathInfo;
                         Hashtable hashtables1 = hashtables;
                         object obj = num;
                         object item = hashtables1[obj];
                         object[] str1 = new object[] { item, num1, ":", row["alarmpathdot"].ToString(), ";" };
                         hashtables[obj] = string.Concat(str1);
                         this.htCarPosInfo[num] = string.Concat(row["Longitude"].ToString(), "*", row["Latitude"].ToString());
                     }
                 }
                 this.setInputXML();
                 this.CheckAndAnalysis();
             }
         }
         catch (Exception exception3)
         {
             Exception exception2 = exception3;
             ErrorMsg errorMsg1 = new ErrorMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", string.Concat("检测偏移路线报警错误,", exception2.Message));
             this.logHelper.WriteError(errorMsg1);
         }
     }
     finally
     {
         this.htCarPathInfo.Clear();
         this.htCarPosInfo.Clear();
         this.xDoc = null;
         this.tCheckPathAlarm.Enabled = true;
     }
 }
Esempio n. 3
0
 private bool getIsInTime(List<DateTime> L1, List<DateTime> L2)
 {
     PlatformAlarmRegionAlarm platformAlarmRegionAlarm = new PlatformAlarmRegionAlarm();
     DateTime svrTime = ReadDataFromDB.GetSvrTime();
     for (int i = 0; i < L1.Count; i++)
     {
         if (platformAlarmRegionAlarm.IsInConfigTime(L1[i], L2[i], svrTime))
         {
             return true;
         }
     }
     return false;
 }
Esempio n. 4
0
 private void tCheckPathAlarm_Elapsed(object sender, ElapsedEventArgs e)
 {
     this.tCheckPathAlarm.Enabled = false;
     try
     {
         try
         {
             PlatformAlarmRegionAlarm platformAlarmRegionAlarm = new PlatformAlarmRegionAlarm();
             this.clearAlarmCar();
             this.dtConfigInfo = this.getConfigInfo();
             if (this.dtConfigInfo != null && this.dtConfigInfo.Rows.Count > 0)
             {
                 foreach (DataRow row in this.dtConfigInfo.Rows)
                 {
                     DateTime dateTime  = Convert.ToDateTime(row["BeginTime"]);
                     DateTime dateTime1 = Convert.ToDateTime(row["EndTime"]);
                     DateTime dateTime2 = Convert.ToDateTime(row["gpsTime"]);
                     if (!platformAlarmRegionAlarm.IsInConfigTime(dateTime, dateTime1, this.dtNow) || !platformAlarmRegionAlarm.IsInConfigTime(dateTime, dateTime1, dateTime2) || dateTime2.Date != this.dtNow.Date)
                     {
                         continue;
                     }
                     int num  = Convert.ToInt32(row["carid"]);
                     int num1 = Convert.ToInt32(row["PathID"]);
                     if (this.htCarPathInfo[num] == null)
                     {
                         this.htCarPathInfo[num] = "";
                     }
                     try
                     {
                         if (this.htAlarmList[num] != null)
                         {
                             this.htAlarmList[num] = (this.htAlarmList[num] as AlarmCarInfo).updateAlarmCar(num, num1, dateTime, dateTime1);
                         }
                         else
                         {
                             this.htAlarmList[num] = AlarmCarInfo.getAlarmCar(num, num1, dateTime, dateTime1);
                         }
                     }
                     catch (Exception exception1)
                     {
                         Exception exception = exception1;
                         ErrorMsg  errorMsg  = new ErrorMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", string.Concat("保存报警车辆信息,", exception.Message));
                         this.logHelper.WriteError(errorMsg);
                     }
                     if (row["Longitude"] == DBNull.Value || row["Latitude"] == DBNull.Value || double.Parse(row["Longitude"].ToString()) < 0.001 || double.Parse(row["Latitude"].ToString()) < 0.001)
                     {
                         if (this.htCarPathInfo.Contains(num))
                         {
                             this.htCarPathInfo.Remove(num);
                         }
                         LogMsg   logMsg = new LogMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", "");
                         object[] str    = new object[] { "carid:", num, ",pathId:", num1.ToString(), ",simnum:", row["simnum"].ToString(), ",轨迹不存在或为0" };
                         logMsg.Msg = string.Concat(str);
                         this.logHelper.WriteLog(logMsg);
                     }
                     else if (row["alarmpathdot"] == DBNull.Value || string.IsNullOrEmpty(row["alarmpathdot"].ToString()))
                     {
                         if (this.htCarPathInfo.Contains(num))
                         {
                             this.htCarPathInfo.Remove(num);
                         }
                         LogMsg   logMsg1  = new LogMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", "");
                         object[] objArray = new object[] { "carid:", num, ",pathId:", num1.ToString(), ",simnum:", row["simnum"].ToString(), ",路线不存在" };
                         logMsg1.Msg = string.Concat(objArray);
                         this.logHelper.WriteLog(logMsg1);
                     }
                     else
                     {
                         Hashtable hashtables  = this.htCarPathInfo;
                         Hashtable hashtables1 = hashtables;
                         object    obj         = num;
                         object    item        = hashtables1[obj];
                         object[]  str1        = new object[] { item, num1, ":", row["alarmpathdot"].ToString(), ";" };
                         hashtables[obj]        = string.Concat(str1);
                         this.htCarPosInfo[num] = string.Concat(row["Longitude"].ToString(), "*", row["Latitude"].ToString());
                     }
                 }
                 this.setInputXML();
                 this.CheckAndAnalysis();
             }
         }
         catch (Exception exception3)
         {
             Exception exception2 = exception3;
             ErrorMsg  errorMsg1  = new ErrorMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", string.Concat("检测偏移路线报警错误,", exception2.Message));
             this.logHelper.WriteError(errorMsg1);
         }
     }
     finally
     {
         this.htCarPathInfo.Clear();
         this.htCarPosInfo.Clear();
         this.xDoc = null;
         this.tCheckPathAlarm.Enabled = true;
     }
 }