private RouteStop GetRouteStopFromLeg(int subscriberId, ImportedLeg leg, StopAction sa, Dictionary <string, Location> locationsByLegacyId, TimeSpan?windowStart = null, TimeSpan?windowEnd = null, int stopDelay = 60) { Location location; try { location = locationsByLegacyId[leg.CustomerNumber]; } catch (Exception ex) { location = new Location() { DisplayName = "Loc not found", }; } if (location != null && (location.DisplayName.ToLower().Contains("publix") || location.DisplayName.ToLower().Contains("associated grocers"))) { stopDelay = 240; } var result = new RouteStop() { SubscriberId = subscriberId, StopAction = sa, LocationId = location.Id, Location = location, StopDelay = stopDelay, WindowStart = windowStart.HasValue ? windowStart.Value.Ticks : 0, WindowEnd = windowEnd.HasValue ? windowEnd.Value.Ticks : new TimeSpan(23, 59, 0).Ticks, }; return(result); }
private RouteStop CreateRouteStop(StopAction sa, string customerNumber, Dictionary <string, Location> locationsByCustomerNumber, int stopDelay, int subscriberId, TimeSpan?windowStart = null, TimeSpan?windowEnd = null) { Location location; try { location = locationsByCustomerNumber[customerNumber]; } catch (Exception ex) { location = new Location() { DisplayName = "Loc not found", }; } // publix should have stop times of 4 hours if (location != null && location.DisplayName.ToLower().Contains("publix")) { stopDelay = 240; } return(new RouteStop() { SubscriberId = subscriberId, Location = location, LocationId = location.Id, StopAction = sa, StopDelay = stopDelay, WindowStart = windowStart != null ? windowStart.Value.Ticks : 0, WindowEnd = windowEnd != null ? windowEnd.Value.Ticks : new TimeSpan(23, 59, 0).Ticks, }); }