示例#1
0
        public void GetSignalLocationTest()
        {
            MetricOptions options = NewOptionsForTest();

            var signalFromDb = _signalRepository.GetLatestVersionOfSignalBySignalID(options.SignalID);

            Assert.IsTrue(options.GetSignalLocation() == signalFromDb.GetSignalLocation());
        }
示例#2
0
 public ActionResult Create([Bind(Include = "SignalID,DirectionTypeID,Description,MPH,DecisionPoint,MovementDelay")] Approach approach)
 {
     ViewBag.DirectionType = new SelectList(directionRepository.GetAllDirections(), "DirectionTypeID", "Abbreviation");
     if (ModelState.IsValid)
     {
         approachRepository.AddOrUpdate(approach);
         approach.Signal = signalRepository.GetLatestVersionOfSignalBySignalID(approach.SignalID);
         return(PartialView("~/Views/Signals/EditorTemplates/Approach.cshtml", approach));
     }
     return(PartialView(approach));
 }
示例#3
0
        public int AddNewVersion(string id)
        {
            var existingSignal = _signalsRepository.GetLatestVersionOfSignalBySignalID(id);
            //if (existingSignal == null)
            //{
            //    return Content("<h1>" +"No Signal Matches this SignalID" + "</h1>");
            //}

            Signal signal = _signalsRepository.CopySignalToNewVersion(existingSignal);

            signal.VersionList = _signalsRepository.GetAllVersionsOfSignalBySignalID(signal.SignalID);

            try
            {
                _signalsRepository.AddOrUpdate(signal);
                var commentRepository = MOE.Common.Models.Repositories.MetricCommentRepositoryFactory.Create();
                foreach (var origVersionComment in existingSignal.Comments)
                {
                    MetricComment metricComment = new MetricComment
                    {
                        CommentText = origVersionComment.CommentText,
                        VersionID   = signal.VersionID,
                        SignalID    = existingSignal.SignalID,
                        TimeStamp   = origVersionComment.TimeStamp,
                    };
                    if (origVersionComment.MetricTypes != null)
                    {
                        metricComment.MetricTypeIDs = new List <int>();
                        foreach (var metricType in origVersionComment.MetricTypes)
                        {
                            metricComment.MetricTypeIDs.Add(metricType.MetricID);
                        }
                    }
                    commentRepository.AddOrUpdate(metricComment);
                }
            }
            catch (Exception ex)
            {
                return(-1);
            }
            finally
            {
                AddSelectListsToViewBag(signal);
            }
            return(signal.VersionID);
        }
示例#4
0
        // GET: ConfigurationTable
        public ActionResult Index(string SignalID)
        {
            MOE.Common.Models.Repositories.ISignalsRepository sr =
                MOE.Common.Models.Repositories.SignalsRepositoryFactory.Create();
            var signal = sr.GetLatestVersionOfSignalBySignalID(SignalID);
            List <MOE.Common.Business.Helpers.ConfigurationRecord> records =
                new List <MOE.Common.Business.Helpers.ConfigurationRecord>();

            foreach (MOE.Common.Models.Detector gd in signal.GetDetectorsForSignal())
            {
                MOE.Common.Business.Helpers.ConfigurationRecord r = new ConfigurationRecord(gd);
                records.Add(r);
            }
            Models.SPMConfigurationTableViewModel model = new Models.SPMConfigurationTableViewModel();
            model.Records = records;
            return(PartialView("ConfigurationTable", model));
        }