private Models.Detector CreateNewDetector(Data.Signals.Graph_DetectorsRow row, List <Models.DetectionType> detectionstypeslist) { Models.Detector detector = new Models.Detector(); detector.DetectorID = row.DetectorID; detector.DetChannel = row.Det_Channel; if (!row.IsNull("Date_Added")) { detector.DateAdded = row.Date_Added; } else { detector.DateAdded = DateTime.Now; } if (detector.DetectionTypes == null && detector.DetectionTypeIDs == null) { detector.DetectionTypeIDs = new List <int>(); detector.DetectionTypes = new List <MOE.Common.Models.DetectionType>(); } GetDetectionTypes(row, detector, detectionstypeslist); if (row.DistanceFromStopBar > 0) { detector.DistanceFromStopBar = row.DistanceFromStopBar; } if (row.Min_Speed_Filter > 0) { detector.MinSpeedFilter = row.Min_Speed_Filter; } if (!String.IsNullOrEmpty(row.Lane) && (String.Compare(row.Lane.ToUpper(), "NULL") != 0)) { detector.LaneNumber = Convert.ToInt32(row.Lane); } if (row.Decision_Point > 0) { detector.DecisionPoint = row.Decision_Point; } if (row.Movement_Delay > 0) { detector.MovementDelay = row.Movement_Delay; } if (!String.IsNullOrEmpty(row.Comments)) { Models.DetectorComment comment = new Models.DetectorComment(); comment.CommentText = row.Comments; comment.TimeStamp = DateTime.Now; detector.DetectorComments = new List <Models.DetectorComment>(); detector.DetectorComments.Add(comment); } if (row.TMC_Lane_Type != null) { SetLaneInfo(row, detector); } return(detector); }
public ConfigurationRecord(MOE.Common.Models.Detector gd) { MOE.Common.Models.Repositories.IDetectorRepository gdr = MOE.Common.Models.Repositories.DetectorRepositoryFactory.Create(); MOE.Common.Models.Repositories.IDetectorCommentRepository dcr = MOE.Common.Models.Repositories.DetectorCommentRepositoryFactory.Create(); string comment = ""; Models.DetectorComment c = dcr.GetMostRecentDetectorCommentByDetectorID(gd.ID); if (c != null) { comment = c.CommentText; } this.Comment = comment; this.DecisionPoint = gd.DecisionPoint.ToString(); this.DetectorChannel = gd.DetChannel.ToString(); this.DetectorID = gd.DetectorID; this.Direction = gd.Approach.DirectionType.Abbreviation; this.DistanceFromStopBar = gd.DistanceFromStopBar.ToString(); this.Enabled = gd.Approach.Signal.Enabled.ToString(); this.MinSpeedFilter = gd.MinSpeedFilter.ToString(); this.MovementDelay = gd.MovementDelay.ToString(); this.MPH = gd.Approach.MPH.ToString(); this.Overlap = gd.Approach.IsProtectedPhaseOverlap.ToString(); this.PermissivePhaseNumber = gd.Approach.PermissivePhaseNumber.ToString(); this.ProtectedPhaseNumber = gd.Approach.ProtectedPhaseNumber.ToString(); this.DetectionHardware = gd.DetectionHardware.Name; if (gd.LaneType != null) { this.LaneType = gd.LaneType.Description; } if (gd.LaneNumber != null) { this.LaneNumber = gd.LaneNumber.ToString(); } if (gd.MovementType != null) { this.MovementType = gd.MovementType.Description; } foreach (MOE.Common.Models.DetectionType dt in gd.DetectionTypes) { this.DetectionTypes += dt.Description + "<br/>"; } }
public ConfigurationRecord(MOE.Common.Models.Graph_Detectors gd) { MOE.Common.Models.Repositories.IGraphDetectorRepository gdr = MOE.Common.Models.Repositories.GraphDetectorRepositoryFactory.Create(); MOE.Common.Models.Repositories.IDetectorCommentRepository dcr = MOE.Common.Models.Repositories.DetectorCommentRepositoryFactory.Create(); string comment = ""; Models.DetectorComment c = dcr.GetMostRecentDetectorCommentByDetectorID(gd.DetectorID); if (c != null) { comment = c.CommentText; } this.Comment = comment; this.DecisionPoint = gd.LaneGroup.Approach.Decision_Point.ToString(); this.DetectorChannel = gd.Det_Channel.ToString(); this.DetectorID = gd.DetectorID; this.Direction = gd.LaneGroup.Approach.DirectionType.Description; this.DistanceFromStopBar = gd.DistanceFromStopBar.ToString(); this.Enabled = gd.LaneGroup.Approach.Signal.Enabled.ToString(); this.LaneType = gd.LaneGroup.MovementType.Abbreviation + gd.LaneNumber.ToString(); this.MinSpeedFilter = gd.Min_Speed_Filter.ToString(); this.MovementDelay = gd.LaneGroup.Approach.Movement_Delay.ToString(); this.MPH = gd.LaneGroup.Approach.MPH.ToString(); this.Overlap = gd.LaneGroup.IsProtectedPhaseOverlap.ToString(); this.PCDEnabled = gdr.CheckReportAvialbility(gd.DetectorID, 6).ToString(); this.PermissivePhaseNumber = gd.LaneGroup.PermissivePhaseNumber.ToString(); this.ProtectedPhaseNumber = gd.LaneGroup.ProtectedPhaseNumber.ToString(); this.SpeedEnabled = gdr.CheckReportAvialbility(gd.DetectorID, 10).ToString(); this.SplitFailEnabled = gdr.CheckReportAvialbility(gd.DetectorID, 12).ToString(); this.TMCEnabled = gdr.CheckReportAvialbility(gd.DetectorID, 5).ToString(); this.YRAEnabled = gdr.CheckReportAvialbility(gd.DetectorID, 11).ToString(); }