public void InsertThongTinCanhBao(string connectionID, string info) { try { AbpSession.Use(1, 2); var infoarr = Regex.Split(info, "@"); var code = infoarr[0]; var trangthai = infoarr[1]; var DESCRIPTION = infoarr[2]; var thietbi = _DM_ThietBiAppService.GetThietBiByConnectionID(connectionID); var canhbao = _DM_CanhBaoService.GetDMCanhBaoByCode(code); if (trangthai == "1") { ThongTinCanhBao item = new ThongTinCanhBao(); item.IDTHIETBI = thietbi.Id; item.IDCANHBAO = canhbao.Id; item.SUCCESS = false; item.START = DateTime.Now; item.END = DateTime.Now; item.noidung = canhbao.NAME; item.TenantId = 1; _repository.Insert(item); } else { var thongtin = GetThongTinCanhBaoByThietBiAndCanhBao(thietbi.Id, canhbao.Id); if (thongtin != null) { thongtin.SUCCESS = true; thongtin.noidung = "KET THUC " + canhbao.NAME; thongtin.END = DateTime.Now; _repository.Update(thongtin); } } } catch (Exception ex) { } }
public async Task <ThongTinCanhBaoDto> GetForEdit(GetThongTinCanhBao input) { ThongTinCanhBao nhomVT = await _repository.GetAsync(input.Id); return(nhomVT.MapTo <ThongTinCanhBaoDto>()); }