protected override async void OnViewLoaded(object view)
        {
            base.OnViewLoaded(view);
            RouteModel rm = RouteDataAccess.GetRouteById(RouteId);

            LocationsUI.RouteName = rm.RouteName;
            RouteId = rm.Id;
            LocationsUI.LocationList = new BindableCollection <LocationModel>(LocationDataAccess.GetAllLocationsPerRoute(RouteId));
            NotifyOfPropertyChange(() => LocationsUI);
        }
 public void EditTimeEvent()
 {
     Location    = LocationDataAccess.GetLocationById(SelectedTimeEvent.LocationId);
     TimeType    = SelectedTimeEvent.EventType;
     ArrivalTime = SelectedTimeEvent.ArrivalTime;
     WaitTime    = SelectedTimeEvent.WaitTime;
     Order       = SelectedTimeEvent.Order;
     TimeEventId = SelectedTimeEvent.Id;
     NotifyOfPropertyChange(() => CanEditTimeEvent);
     NotifyOfPropertyChange(() => CanSaveTimeEvent);
     NotifyOfPropertyChange(() => TimeEventTypeList);
     NotifyOfPropertyChange(() => TimeType);
 }
        public void TestInitLocation()
        {
            //making sure the table is empty
            TestBuisness.clearAllTable();

            l1           = new Location();
            l2           = new Location();
            l1.latitude  = 1.11;
            l1.longitude = 1.21;
            l1.city      = "Beer-Sheva";
            l2.latitude  = 2.1;
            l2.longitude = 2.2;
            l2.city      = "Tel-Aviv";
            loc_da       = new  LocationDataAccess();
        }
        protected override async void OnViewLoaded(object view)
        {
            base.OnViewLoaded(view);
            TimeEvents.SelectedRoute   = RouteDataAccess.GetRouteById(RouteId);
            TimeEvents.SelectedService = ServiceTemplateDataAccess.GetServiceTemplateById(ServiceId);
            TimeEvents.LocationList    = new BindableCollection <LocationModel>(LocationDataAccess.GetAllLocationsPerRoute(RouteId));
            var temp = FullTimeEventDataAccess.GetAllFullTimeEventsPerServiceTemplate(ServiceId)
                       .OrderBy(p => p.Order)
                       .ToList();

            TimeEvents.FilteredFullTimeEventList = new BindableCollection <FullTimeEventModel>(temp);
            TimeEventTypeList = TimeEventTypeDataAccess.GetAllTimeEventTypeStrings();
            NotifyOfPropertyChange(() => TimeEventTypeList);
            NotifyOfPropertyChange(() => TimeEvents);
        }
示例#5
0
        public ScottPlotGraph(int timetableId)
        {
            TimetableId = timetableId;
            Timetable   = TimetableDataAccess.GetTimetableById(TimetableId);

            LocationList = new ObservableCollection <LocationModel>(LocationDataAccess.GetAllLocationsPerRoute(Timetable.RouteId)
                                                                    .OrderBy(x => x.Order)
                                                                    .ToList());
            int i = 0;

            foreach (var item in LocationList)
            {
                item.Order = i++;
            }
            OnPropertyChanged("LocationList");
            PrepareDataSet();
        }
        public void SaveLocation()
        {
            var newLocation = new LocationModel();

            newLocation.LocationName         = LocationName;
            newLocation.LocationAbbreviation = LocationAbbreviation;
            newLocation.Order          = Order;
            newLocation.NumberOfTracks = NumberOfTracks;
            newLocation.RouteId        = RouteId;
            if (LocationId <= 0)
            {
                LocationDataAccess.InsertLocationForRoute(newLocation);
            }
            else
            {
                newLocation.Id = LocationId;
                LocationDataAccess.UpdateLocationForRoute(newLocation);
            }
            LocationsUI.LocationList = new BindableCollection <LocationModel>(LocationDataAccess.GetAllLocationsPerRoute(RouteId));
            NotifyOfPropertyChange(() => LocationsUI.LocationList);
            NotifyOfPropertyChange(() => LocationsUI);
            ClearLocation();
        }
        protected override void OnViewLoaded(object view)
        {
            base.OnViewLoaded(view);
            Timetable    = TimetableDataAccess.GetTimetableById(TimetableId);
            LocationList =
                new BindableCollection <LocationModel>(
                    LocationDataAccess.GetAllLocationsPerRoute(Timetable.RouteId)
                    .OrderBy(x => x.Order)
                    .ToList());
            int i = 0;

            foreach (var item in LocationList)
            {
                item.Order = i++;
            }


            SetPeriod();             // sets start and end time at the graph
            Dummy += 1;
            LocationList.Refresh();
            PrepareDataSet();
            TimeGraphUIChanged++;
            TimeGraphUI.Refresh();
        }
 public void DeleteLocation()
 {
     LocationDataAccess.DeleteLocation(SelectedLocation.Id);
     LocationsUI.LocationList.Remove(SelectedLocation);
     LocationId = 0;
 }
示例#9
0
 protected override async void OnViewLoaded(object view)
 {
     base.OnViewLoaded(view);
     LocationList = new BindableCollection <LocationModel>(LocationDataAccess.GetAllLocationsPerRoute(RouteId));
     NotifyOfPropertyChange(() => LocationList);
 }