Ejemplo n.º 1
0
        private void CopyDetectors(Approach apprFromDb, Approach newApp)
        {
            var detectorsFromDb = (from r in _db.Detectors
                                   where r.ApproachID == apprFromDb.ApproachID
                                   select r).ToList();

            foreach (var detFromDb in detectorsFromDb)
            {
                var newDetector = new Detector();

                newDetector.DecisionPoint       = detFromDb.DecisionPoint;
                newDetector.ApproachID          = newApp.ApproachID;
                newDetector.DateAdded           = DateTime.Today;
                newDetector.DetChannel          = detFromDb.DetChannel;
                newDetector.DetectionHardwareID = detFromDb.DetectionHardwareID;
                newDetector.DetectorID          = detFromDb.DetectorID;
                newDetector.LaneNumber          = detFromDb.LaneNumber;
                newDetector.DetectorCommentIDs.AddRange(detFromDb.DetectorCommentIDs);
                newDetector.MovementTypeID      = detFromDb.MovementTypeID;
                newDetector.MinSpeedFilter      = detFromDb.MinSpeedFilter;
                newDetector.DistanceFromStopBar = detFromDb.DistanceFromStopBar;

                _db.Detectors.Add(newDetector);
                //_db.SaveChanges();
            }
        }
Ejemplo n.º 2
0
 private void SetChartTitles(Chart chart, MOE.Common.Models.Detector detector)
 {
     chart.Titles.Add(ChartTitleFactory.GetChartName(this.MetricTypeID));
     chart.Titles.Add(ChartTitleFactory.GetSignalLocationAndDateRange(
                          this.SignalID, this.StartDate, this.EndDate));
     chart.Titles.Add(ChartTitleFactory.GetPhaseAndPhaseDescriptions(detector.Approach.ProtectedPhaseNumber, detector.Approach.DirectionType.Description));
     chart.Titles.Add(ChartTitleFactory.GetTitle("Detection Type: " + detector.DetectionHardware.Name + "; Speed Accuracy +/- 2 mph" + "\n" + "Detector Distance from Stop Bar: " + detector.DistanceFromStopBar.ToString() + " feet; "
                                                 + "\n" + "Includes records over 5mph that occur between 15s after start of green to start of yellow."));
 }
Ejemplo n.º 3
0
        static private string FindDetector(MOE.Common.Models.Signal Signal, int Channel)
        {
            try
            {
                MOE.Common.Models.Detector gd = Signal.GetDetectorForSignalByChannel(Channel);

                if (gd != null)
                {
                    return(gd.DetectorID);
                }
                else
                {
                    return("0");
                }
            }
            catch
            {
                return("0");
            }
        }