Beispiel #1
0
        private void BtnRemoveAlarm_Click(object sender, RoutedEventArgs e)
        {
            var service = new LocationService();
            var alarms  = service.GetLocationAlarms(2, false);

            AlarmHub.SendLocationAlarms(alarms.ToArray());
        }
        private void EngineClient_NewAlarmsFired(List <DbModel.Location.Alarm.LocationAlarm> obj)
        {
            var alarms = obj.ToTModel().ToArray();

            AlarmHub.SendLocationAlarms(alarms);
            AreaCanvas1.ShowLocationAlarms(alarms);
        }
Beispiel #3
0
        private void BtnPushAlarm_OnClick(object sender, RoutedEventArgs e)
        {
            //LocationCallbackService.NotifyServiceStop();
            var service = new LocationService();
            var alarms  = service.GetLocationAlarms(2);

            AlarmHub.SendLocationAlarms(alarms.ToArray());
        }
        /// <summary>
        /// 批量删除告警
        /// </summary>
        /// <param name="idList"></param>
        /// <returns></returns>
        public bool DeleteLocationAlarm(List <int> idList)
        {
            BLL.Bll bll = new BLL.Bll(false, true, true);
            BLL.Buffers.AuthorizationBuffer             ab           = BLL.Buffers.AuthorizationBuffer.Instance(bll);
            List <DbModel.Location.Alarm.LocationAlarm> reviseAlarms = ab.DeleteSpecifiedLocationAlarm(idList);

            if (reviseAlarms == null || reviseAlarms.Count == 0)
            {
                return(false);
            }
            else
            {
                //新增,服务端消警后,把消警信息发给客户端
                var alarms = reviseAlarms.ToTModel().ToArray();
                AlarmHub.SendLocationAlarms(alarms);
                return(true);
            }
        }
        public override bool TickFunction()
        {
            try
            {
                //每天清除进入区域记录
                DateTime now = DateTime.Now;
                if (now.Hour == 23)
                {
                    bool result = DeleteRecord();
                }

                //产生告警
                List <LocationAlarm> newAlarmList = new List <LocationAlarm>();
                newAlarmList.AddRange(GetAlarmList());
                dbAlarmList = db.LocationAlarms.ToList();
                foreach (var item in dbAlarmList)
                {
                    newAlarmList.RemoveAll(i => i.PersonnelId == item.PersonnelId && i.AreaId == item.AreaId && i.AlarmType == item.AlarmType);
                }
                if (newAlarmList != null && newAlarmList.Count > 0)
                {
                    //dbAlarmList.AddRange(newAlarmList);
                    List <LocationAlarm> boolList = new List <LocationAlarm>();
                    foreach (LocationAlarm alarm in newAlarmList)
                    {
                        bool result = db.LocationAlarms.Add(alarm);
                        if (result)
                        {
                            boolList.Add(alarm);
                        }
                    }
                    //db.LocationAlarms.AddRange(newAlarmList);

                    AlarmHub.SendLocationAlarms(boolList.ToTModel().ToArray());
                }
            }
            catch (Exception ex)
            {
                Log.Error("SignInAlarmThread:" + ex.ToString());
            }

            return(true);
        }
 private void EngineClient_NewAlarmsFired(List <DbModel.Location.Alarm.LocationAlarm> obj)
 {
     AlarmHub.SendLocationAlarms(obj.ToTModel().ToArray());
 }
Beispiel #7
0
 private void EngineClient_NewAlarmsFired(List <DbModel.Location.Alarm.LocationAlarm> obj)
 {
     Log.Info("LocationAlarm", "AlarmHub.SendLocationAlarms:" + obj.Count);
     AlarmHub.SendLocationAlarms(obj.ToTModel().ToArray());
 }