Exemple #1
0
        internal void OnRouteChanged(BusRoute selectedRoute, RouteBeginTime.ScheduleDays scheduleDays, int routeVariant)
        {
            RouteDetailsForRoute = RouteDetails.Where(route => route.RouteId == selectedRoute.Id && route.RouteVariantId == routeVariant).ToList();
            BeginTimesForRoute   = RouteBeginTimes.Where(beginTime => beginTime.RouteId == selectedRoute.Id && beginTime.Days == scheduleDays && beginTime.RouteVariant == routeVariant).OrderBy(beginTime => beginTime.Time).ToList();
            RouteVariants        = Enumerable.Range(0, selectedRoute.VariantsNum).ToList();

            OnPropertyChanged(nameof(RouteDetailsForRoute));
            OnPropertyChanged(nameof(BeginTimesForRoute));
            OnPropertyChanged(nameof(RouteVariants));
        }
        private void ScheduleDaysChanged(object sender, SelectionChangedEventArgs e)
        {
            if (RoutesList.SelectedItem != null && RoutesList.SelectedItem is BusRoute route)
            {
                RouteBeginTime.ScheduleDays sd = RouteBeginTime.ScheduleDays.WorkingDays;
                switch (scheduleDaysSwitch.SelectedIndex)
                {
                case 0:
                    sd = RouteBeginTime.ScheduleDays.WorkingDays;
                    break;

                case 1:
                    sd = RouteBeginTime.ScheduleDays.Saturday;
                    break;

                case 2:
                    sd = RouteBeginTime.ScheduleDays.SundayAndHolidays;
                    break;
                }
                _viewModel.OnRouteChanged(route, sd, RouteVariants.SelectedIndex);
            }
        }
Exemple #3
0
 internal void OnRouteStationChanged(BusRoute route, int routeVariant, RouteBeginTime.ScheduleDays scheduleDays, RouteStationViewModel stationViewModel)
 {
     TimeAdjustmentsForSelection = TimeAdjustments.Where(item => item.RouteBeginTime.RouteId == route.Id && item.RouteBeginTime.RouteVariant == routeVariant && item.RouteBeginTime.Days == scheduleDays && item.StationId == stationViewModel.BusStation.Id).ToList();
     OnPropertyChanged(nameof(TimeAdjustmentsForSelection));
 }
Exemple #4
0
 internal IEnumerable <TimeAdjustmentViewModel> GetTimeAdjustmentsForRouteVariant(BusRoute route, int routeVariant, RouteBeginTime.ScheduleDays scheduleDays)
 {
     return(TimeAdjustments.Where(item => item.RouteBeginTime.RouteId == route.Id && item.RouteBeginTime.RouteVariant == routeVariant && item.RouteBeginTime.Days == scheduleDays));
 }