예제 #1
0
        public void SaveTimetable()
        {
            var newTimetable = new TimetableModel();

            newTimetable.TimetableDescription  = TimetableDescription;
            newTimetable.TimetableName         = TimetableName;
            newTimetable.TimetableAbbreviation = TimetableAbbreviation;
            newTimetable.RouteId          = RouteId;
            newTimetable.IsMultiDirection = IsMultiDirection;
            if (IsMultiDirection)
            {
                newTimetable.ServiceDirectionId = -1;
            }
            else
            {
                newTimetable.ServiceDirectionId = ServiceDirectionId;
            }
            if (TimetableId <= 0)
            {
                TimetableDataAccess.InsertTimetableForRoute(newTimetable);
            }
            else
            {
                newTimetable.Id = TimetableId;
                TimetableDataAccess.UpdateTimetable(newTimetable);
            }
            ClearTimetable();
            TimetablesUI.TimetableList = new BindableCollection <TimetableModel>(TimetableDataAccess.GetAllTimetablesPerRoute(RouteId));
            NotifyOfPropertyChange(() => TimetablesUI);
        }
예제 #2
0
        protected override async void OnViewLoaded(object view)
        {
            base.OnViewLoaded(view);
            RouteModel rm = RouteDataAccess.GetRouteById(RouteId);

            TimetablesUI.RouteName = rm.RouteName;
            RouteId = rm.Id;
            TimetablesUI.TimetableList = new BindableCollection <TimetableModel>(TimetableDataAccess.GetAllTimetablesPerRoute(RouteId));
            ServiceDirectionList       = new BindableCollection <ServiceDirectionModel>(ServiceDirectionDataAccess.GetAllServiceDirectionsPerRoute(RouteId));
            NotifyOfPropertyChange(() => TimetablesUI);
        }