Beispiel #1
0
        void AddSchedulerMethod()
        {
            ObservableCollection <Models.RouteScheduler> RouteSchedulerList = new ObservableCollection <Models.RouteScheduler>();

            RouteSchedulerList.Add(new Models.RouteScheduler());
            ViewModels.AddSchedulerViewModel addSchedulerViewModel = new AddSchedulerViewModel(RouteSchedulerList);
            Views.AddSchedulerView           addSchedulerView      = new Views.AddSchedulerView(
                addSchedulerViewModel
                );
            addSchedulerView.Owner = CurrentSchedulerWindow;
            MakeLogEntry(8, null, null, "open AddScheduler. Start adding scheduler");
            if ((bool)addSchedulerView.ShowDialog())
            {
                foreach (Models.RouteScheduler item in addSchedulerViewModel.CurrentRouteSchedulerCollection)
                {
                    Models.RouteScheduler routeScheduler = Models.RouteScheduler.GetCopyOfRouteScheduler(item);
                    routeScheduler.RouteId = CurrentRoute.Id;
                    AddEntry <Models.RouteScheduler>(routeScheduler);
                    CurrnetRouteScheduler.Add(routeScheduler);
                    CurrnetRouteScheduler = new ObservableCollection <Models.RouteScheduler>(
                        CurrnetRouteScheduler.OrderBy(o => o.StartTime).OrderBy(o => o.DayOfWeek));
                    AddSchedulerEntryToDetail(routeScheduler);
                }
                CurrentRouteScheduler_Changed();
            }
            else
            {
                MakeLogEntry(8, null, null, "open AddScheduler. Cancel adding scheduler");
            }
        }
Beispiel #2
0
        void EditSchedulerMethod(Models.RouteScheduler SelectedItem)
        {
            if (SelectedItem == null)
            {
                return;
            }
            ObservableCollection <Models.RouteScheduler> RouteSchedulerList = new ObservableCollection <Models.RouteScheduler>();

            RouteSchedulerList.Add(
                Models.RouteScheduler.GetCopyOfRouteScheduler(SelectedItem)
                );
            ViewModels.AddSchedulerViewModel addSchedulerViewModel = new AddSchedulerViewModel(RouteSchedulerList);
            Views.AddSchedulerView           addSchedulerView      = new Views.AddSchedulerView(
                addSchedulerViewModel
                );
            addSchedulerView.Owner = CurrentSchedulerWindow;
            MakeLogEntry(8, null, null, "open AddScheduler. Start editing scheduler");
            if ((bool)addSchedulerView.ShowDialog())
            {
                foreach (Models.RouteScheduler item in addSchedulerViewModel.CurrentRouteSchedulerCollection)
                {
                    Models.RouteScheduler routeScheduler = Models.RouteScheduler.GetCopyOfRouteScheduler(item);
                    if (routeScheduler.Id == 0)
                    {
                        AddEntry <Models.RouteScheduler>(routeScheduler);
                        CurrnetRouteScheduler.Add(routeScheduler);
                        CurrentSchedulerWindow.CurrentSchedulerVisual.CurrentRouteScheduler = CurrnetRouteScheduler;
                        AddSchedulerEntryToDetail(routeScheduler);
                    }
                    else
                    {
                        EditEntry <Models.RouteScheduler>(routeScheduler);
                        EditOdRemoveSchedulerEntryInDetail(routeScheduler, 1);
                    }
                }
                CurrnetRouteScheduler = new ObservableCollection <Models.RouteScheduler>(
                    CurrnetRouteScheduler.OrderBy(o => o.StartTime).OrderBy(o => o.DayOfWeek));
                CurrentRouteScheduler_Changed();
            }
            else
            {
                MakeLogEntry(8, null, null, "open AddScheduler. Cancel editing scheduler");
            }
        }