private void SetChartTitle(Chart chart, Approach approach, Dictionary <string, string> statistics) { var detectorsForMetric = approach.GetDetectorsForMetricType(this.MetricTypeID); string message = "\n Advanced detector located " + detectorsForMetric.FirstOrDefault().DistanceFromStopBar.ToString() + " ft. upstream of stop bar"; chart.Titles.Add(ChartTitleFactory.GetChartName(this.MetricTypeID)); chart.Titles.Add(ChartTitleFactory.GetSignalLocationAndDateRangeAndMessage(approach.SignalID, this.StartDate, this.EndDate, message)); chart.Titles.Add(ChartTitleFactory.GetPhaseAndPhaseDescriptions(approach.ProtectedPhaseNumber, approach.DirectionType.Description)); chart.Titles.Add(ChartTitleFactory.GetStatistics(statistics)); }
public ControllerEventLogs CombineDetectorDataByApproachAndType(DateTime startDate, DateTime endDate, Approach approach, bool Has_PCD, bool Has_TMC) { var gr = DetectorRepositoryFactory.Create(); var signalId = approach.SignalID; if (Has_TMC) { ApproachCountDetectors.Clear(); ApproachCountDetectors.AddRange(RemoveExitDetectors(approach.GetDetectorsForMetricType(5))); } if (Has_PCD) { ApproachCountDetectors.Clear(); ApproachCountDetectors.AddRange(RemoveExitDetectors(approach.GetDetectorsForMetricType(6))); } var eventsList = new List <ControllerEventLogs>(); var MergedEvents = new ControllerEventLogs(signalId, startDate, endDate); foreach (var detector in ApproachCountDetectors) { var li = new List <int> { 82 }; var cs = new ControllerEventLogs(signalId, startDate, endDate, detector.DetChannel, li); eventsList.Add(cs); } foreach (var Events in eventsList) { MergedEvents.MergeEvents(Events); } return(MergedEvents); }
private void GetDetectorEvents(int metricTypeId) { var celRepository = ControllerEventLogRepositoryFactory.Create(); DetectorEvents = new List <Controller_Event_Log>(); var detectorsForMetric = Approach.GetDetectorsForMetricType(metricTypeId); foreach (var d in detectorsForMetric) { DetectorEvents.AddRange(celRepository.GetEventsByEventCodesParamWithOffsetAndLatencyCorrection(Approach.SignalID, StartDate, EndDate, new List <int> { 82 }, d.DetChannel, d.GetOffset(), d.LatencyCorrection)); } }
/// <summary> /// Alternate Constructor for PCD type data. /// </summary> /// <param name="signalid"></param> /// <param name="approach"></param> public DetectorCollection(Approach approach) { SignalId = approach.SignalID; var repository = SignalsRepositoryFactory.Create(); var PCDDetectors = approach.GetDetectorsForMetricType(6); foreach (var row in PCDDetectors) { var Detector = new Detector(row); Items.Add(Detector); } }
private void GetChart(SplitFailPhase splitFailPhase, string chartName, List <string> returnString, bool getPermissivePhase, Approach approach) { var sfChart = new SplitFailChart(this, splitFailPhase, getPermissivePhase); var detector = approach.GetDetectorsForMetricType(12).FirstOrDefault(); if (detector != null) { var direction = detector.MovementType.Description; if (getPermissivePhase) { sfChart.Chart.BackColor = Color.LightGray; } } Thread.Sleep(300); chartName = chartName.Replace(".", approach.DirectionType.Description + "."); try { sfChart.Chart.SaveImage(MetricFileLocation + chartName, ChartImageFormat.Jpeg); } catch (Exception ex) { try { sfChart.Chart.SaveImage(MetricFileLocation + chartName, ChartImageFormat.Jpeg); } catch { var appEventRepository = ApplicationEventRepositoryFactory.Create(); var applicationEvent = new ApplicationEvent(); applicationEvent.ApplicationName = "SPM Website"; applicationEvent.Description = MetricType.ChartName + ex.Message + " Failed While Saving File"; applicationEvent.SeverityLevel = ApplicationEvent.SeverityLevels.Medium; applicationEvent.Timestamp = DateTime.Now; appEventRepository.Add(applicationEvent); } } returnString.Add(MetricWebPath + chartName); }