private static void ReportStatus(Endpoint endpoint, EndpointStatus newStatus) { foreach (var reporter in reporterRepo.GetConfiguredReporters()) { reporter.Report(endpoint, newStatus); } }
private static void ReportStatus( Endpoint endpoint, EndpointStatus newStatus ) { foreach ( var reporter in reporterRepo.GetConfiguredReporters() ) { reporter.Report( endpoint, newStatus ); } }
private static void Monitor_EndpointChecked(EndpointCheckedEventArgs args) { var newStatus = new EndpointStatus() { Timestamp = args.Timestamp, StatusCode = args.StatusCode }; var endpoint = endpointRepo.Get(args.Url); if (StatusShouldBeReported(endpoint.LastStatus, newStatus)) { ReportStatus(endpoint, newStatus); } endpoint.Statuses.Add(newStatus); endpointRepo.SaveChanges(); }
private static void Monitor_EndpointChecked( EndpointCheckedEventArgs args ) { var newStatus = new EndpointStatus() { Timestamp = args.Timestamp, StatusCode = args.StatusCode }; var endpoint = endpointRepo.Get( args.Url ); if ( StatusShouldBeReported( endpoint.LastStatus, newStatus ) ) { ReportStatus( endpoint, newStatus ); } endpoint.Statuses.Add( newStatus ); endpointRepo.SaveChanges(); }
private static bool StatusShouldBeReported(EndpointStatus lastStatus, EndpointStatus newStatus) { if (lastStatus != null) { // If the new status is different from the last status then it should be reported. if (lastStatus.Status != newStatus.Status) { return(true); } } else // If the endpoint has never been checked before but is down then it should be reported. { if (newStatus.Status == Status.Down) { return(true); } } return(false); }
private static bool StatusShouldBeReported( EndpointStatus lastStatus, EndpointStatus newStatus ) { if ( lastStatus != null ) { // If the new status is different from the last status then it should be reported. if ( lastStatus.Status != newStatus.Status ) { return true; } } else // If the endpoint has never been checked before but is down then it should be reported. { if ( newStatus.Status == Status.Down ) { return true; } } return false; }