Esempio n. 1
0
        public async Task SendMessageAlarm(string ip, string path, string code, string status)
        {
            var thietbi = _dm_ThietBiAppService.GetThietBiByIP(ip);

            if (thietbi != null)
            {
                var message = code + "@" + status + "@";
                AbpSession.Use(1, 2);
                await _lichSuHoatDongThietBiAppService.SaveLogHoatDong(thietbi, code, status, "");

                await _thongTin_ThietBiAppService.UpdateTrangThaiDieuKhien(thietbi.Id, code, status, path);

                Clients.All.getMessageAlarm(thietbi.ConnectionID, message);
            }
        }
Esempio n. 2
0
        public async Task <string> SendInforAlarm(AlarmModel alarm)
        {
            AbpSession.Use(1, 2);
            var         abc             = AbpSession.UserId;
            KetQuaModel result          = new KetQuaModel();
            var         loginResultVNPT = _webService.AuthCenter(alarm.USERNAME, alarm.PASSWORD);

            if (loginResultVNPT != null)
            {
                if (loginResultVNPT.isError == false)
                {
                    result.LOGIN = true;
                    try
                    {
                        var thietbi = _dm_ThietBiAppService.GetThietBiByIP(alarm.IPADDRESS);
                        if (thietbi != null)
                        {
                            var url     = alarm.PATH.Replace("@D:\\FTP\\IPCAMERA", "http://10.10.117.175:7711");
                            var message = alarm.CODE + "@" + alarm.STATUS + "@" + alarm.PATH;
                            await _lichSuHoatDongThietBiAppService.SaveLogHoatDong(thietbi, alarm.CODE, alarm.STATUS, url);

                            await _thongTin_ThietBiAppService.UpdateTrangThaiDieuKhien(thietbi.Id, alarm.CODE, alarm.STATUS, url);

                            var context = GlobalHost.ConnectionManager.GetHubContext <ChatHub>();
                            context.Clients.All.getMessageAlarm(thietbi.ConnectionID, message);
                            result.SUCCESS = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        result.SUCCESS = false;
                        result.ERROR   = ex.InnerException.Message;
                    }
                }
            }
            else
            {
            }
            string output = JsonConvert.SerializeObject(result);

            return(output);
        }