Exemple #1
0
        /// <summary>
        /// 从数据库中获取报警信息
        /// </summary>
        private void GetAlarmData()
        {
            int aaa = -2;

            while (!isOver)
            {
                //获取告警信息
                List <string> alarmList  = GetAlarmMsg();
                string[]      alarmSplit = { "@#" };
                if (alarmList != null)
                {
                    List <AlarmData> msgDataList = new List <AlarmData>();
                    foreach (string kv in alarmList)
                    {
                        string[] values = kv.Split(alarmSplit, StringSplitOptions.None);
                        if (values.Length == 7)
                        {
                            string id        = values[0];
                            string cardid    = values[1];
                            string Name      = values[2];
                            string locatorid = values[3];
                            string time      = values[4];
                            string alarmType = values[5];
                            string areaName  = values[6];

                            AlarmData msg = new AlarmData(id, cardid, Name, locatorid, areaName, time, alarmType);
                            msgDataList.Add(msg);
                        }
                    }
                    if (AlarmEvent != null)
                    {
                        AlarmEvent(msgDataList);
                    }
                }
                Thread.Sleep(4000);
            }
        }
Exemple #2
0
        /// <summary>
        /// 从数据库中获取报警信息
        /// </summary>
        private void GetAlarmData()
        {
            int aaa = -2;
            while (!isOver)
            {
                //获取告警信息
                List<string> alarmList = GetAlarmMsg();
                string[] alarmSplit = { "@#" };
                if (alarmList != null)
                {
                    List<AlarmData> msgDataList = new List<AlarmData>();
                    foreach (string kv in alarmList)
                    {
                        string[] values = kv.Split(alarmSplit, StringSplitOptions.None);
                        if (values.Length == 7)
                        {
                            string id = values[0];
                            string cardid = values[1];
                            string Name = values[2];
                            string locatorid = values[3];
                            string time = values[4];
                            string alarmType = values[5];
                            string areaName = values[6];

                            AlarmData msg = new AlarmData(id, cardid, Name, locatorid, areaName, time, alarmType);
                            msgDataList.Add(msg);

                        }
                    }
                    if (AlarmEvent != null)
                    {
                        AlarmEvent(msgDataList);
                    }
                }
                Thread.Sleep(4000);
            }
        }