コード例 #1
0
        public void Update(RoutePhaseDirection newRoutePhaseDirection)
        {
            CheckForExistingApproach(newRoutePhaseDirection);
            var routePhaseDirection =
                db.RoutePhaseDirections.Where(r => r.Id == newRoutePhaseDirection.Id).FirstOrDefault();

            if (routePhaseDirection != null)
            {
                try
                {
                    db.Entry(routePhaseDirection).CurrentValues.SetValues(newRoutePhaseDirection);
                    db.SaveChanges();
                }

                catch (Exception e)
                {
                    var errorLog = ApplicationEventRepositoryFactory.Create();
                    errorLog.QuickAdd(Assembly.GetExecutingAssembly().GetName().ToString(),
                                      GetType().DisplayName(), e.TargetSite.ToString(), ApplicationEvent.SeverityLevels.High,
                                      e.Message);
                    throw new Exception("");
                }
            }
            else
            {
                Add(newRoutePhaseDirection);
            }
        }
コード例 #2
0
 public void UpdateApproach(RoutePhaseDirection routePhaseDirection)
 {
     if (ModelState.IsValid)
     {
         var routePhaseDirectionRepository = MOE.Common.Models.Repositories.RoutePhaseDirectionRepositoryFactory.Create();
         routePhaseDirectionRepository.Update(routePhaseDirection);
     }
 }
コード例 #3
0
        private void CheckForExistingApproach(RoutePhaseDirection newRoutePhaseDirection)
        {
            var routePhaseDirection = db.RoutePhaseDirections.Where(r =>
                                                                    r.RouteSignalId == newRoutePhaseDirection.RouteSignalId &&
                                                                    r.IsPrimaryApproach == newRoutePhaseDirection.IsPrimaryApproach).FirstOrDefault();

            if (routePhaseDirection != null)
            {
                db.RoutePhaseDirections.Remove(routePhaseDirection);
                db.SaveChanges();
            }
        }
コード例 #4
0
        private static List <RoutePhaseDirection> CreateRoutePhaseDirections(RouteSignal signal, OldRouteDetail detail,
                                                                             Approach approach, SPM db)
        {
            List <RoutePhaseDirection> phaseDirecitons = new List <RoutePhaseDirection>();
            RoutePhaseDirection        phaseDireciton  = new RoutePhaseDirection();

            phaseDireciton.RouteSignal       = signal;
            phaseDireciton.DirectionTypeId   = approach.DirectionTypeID;
            phaseDireciton.Phase             = approach.ProtectedPhaseNumber;
            phaseDireciton.IsOverlap         = approach.IsProtectedPhaseOverlap;
            phaseDireciton.IsPrimaryApproach = true;
            phaseDirecitons.Add(phaseDireciton);
            return(phaseDirecitons);
        }
コード例 #5
0
 public void Add(RoutePhaseDirection newRoutePhaseDirection)
 {
     try
     {
         db.RoutePhaseDirections.Add(newRoutePhaseDirection);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         var errorLog = ApplicationEventRepositoryFactory.Create();
         errorLog.QuickAdd(Assembly.GetExecutingAssembly().GetName().ToString(),
                           GetType().DisplayName(), e.TargetSite.ToString(), ApplicationEvent.SeverityLevels.High, e.Message);
         throw new Exception("");
     }
 }
コード例 #6
0
 public void Update(RoutePhaseDirection routePhaseDirection)
 {
     throw new System.NotImplementedException();
 }
コード例 #7
0
        public RoutePhaseDirection GetByID(int routeID)
        {
            RoutePhaseDirection pd = _db.RoutePhaseDirection.Find(r => r.Id == routeID);

            return(pd);
        }
コード例 #8
0
 public void Add(RoutePhaseDirection newRRoutePhaseDirection)
 {
     throw new System.NotImplementedException();
 }