/// <summary> /// remove the selected station from the Collection of station of the new line /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">e of the argument</param> private void Remove_Station(object sender, RoutedEventArgs e) { Button bt = sender as Button; BO.BusStation busStation = bt.DataContext as BO.BusStation; newbusStationsList.Remove(busStation); busStationsList.Add(busStation); }
public BO.BusStation BusStationDoBoAdapter(DO.BusStation stationDo) { BO.BusStation stationBo = new BO.BusStation(); stationDo.CopyPropertiesTo(stationBo); List <int> test = (from line in dl.GetAllLineStationsBy(s => s.StationKey == stationBo.BusStationKey) select line.LineId).ToList(); stationBo.LinesThatPass = test; return(stationBo); }
public void UpdateBusStation(BO.BusStation station) { try { dl.UpdateStation(BusStationBoDoAdapter(station)); } catch { throw new ArgumentException("This Bus Station not exist"); } }
public void AddStation(BO.BusStation newStation) { DO.BusStation stationToAdd = BusStationBoDoAdapter(newStation); try { dl.AddStation(stationToAdd); } catch { throw new ArgumentException("BL failed to add station because : Duplicate Stations"); } }
DO.BusStation BusStationBoDoAdapter(BO.BusStation stationBo) { DO.BusStation stationDo = new DO.BusStation(); stationBo.CopyPropertiesTo(stationDo); if (stationDo.Latitude == 0) { stationDo.Latitude = rndLat.NextDouble() + 31; } if (stationDo.Longitude == 0) { stationDo.Longitude = rndLong.NextDouble() + 34; } return(stationDo); }
public StationInfo(BO.BusStation station) { InitializeComponent(); try { bl = BLFactory.GetBL(); } catch (BO.MissingData ex) { MessageBox.Show(ex.Message); this.Close(); } busStation = station; lines = new ObservableCollection <BO.Line>(busStation.LinesInstation); MainGrid.DataContext = busStation; LinesDataGrid.ItemsSource = lines; //WRONG!!! MyMap.Center = new Location(busStation.Position.Latitude, busStation.Position.Longitude); UpdateBtn.IsEnabled = false; }
public IEnumerable <BO.LineTrip> GetTripsForAStation(BO.BusLine line, BO.BusStation station) { return(from trip in dl.GetAllLineTrips() where trip.LineNumber == line.BusLineNumber && trip.StationKey == station.BusStationKey select LineTripDoBoAdapter(trip)); }
public BO.FollowingStations GetFollowingStations(BO.BusStation station1, BO.BusStation station2) { return(FollowingStationDoBoAdapter(dl.GetFollowingStations( BusStationBoDoAdapter(station1), BusStationBoDoAdapter(station2)))); }