private static async Task SendAsync(WebTelegramReporter cls) { try { using (var client = new HttpClient()) { var json = Json.ToStringJson(cls); var content = new StringContent(json, Encoding.UTF8, "application/json"); var result = await client.PostAsync(Utilities.WebApi + "/api/TelegramReporter/SendAsync", content); } } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
public static async Task SendScrapperReportAsync(List <ScrapperReportViewModel> cls) { try { var str = new WebTelegramReporter() { CustomerGuid = Guid.Empty, Source = ENSource.Scrapper, Message = GetTelegramMessage(cls), Date = DateTime.Now }; await SendAsync(str); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
public static async Task SendBuildingReport(Guid cusGuid, string message) { try { var res = await Utilities.PingHostAsync(); if (res.HasError) { return; } var str = new WebTelegramReporter() { CustomerGuid = cusGuid, Date = DateTime.Now, Source = ENSource.Building, Message = message }; await SendAsync(str); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }