/// <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);
        }
Пример #2
0
        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);
        }
Пример #3
0
 public void UpdateBusStation(BO.BusStation station)
 {
     try
     {
         dl.UpdateStation(BusStationBoDoAdapter(station));
     }
     catch
     {
         throw new ArgumentException("This Bus Station not exist");
     }
 }
Пример #4
0
 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");
     }
 }
Пример #5
0
 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;
 }
Пример #7
0
 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));
 }
Пример #8
0
 public BO.FollowingStations GetFollowingStations(BO.BusStation station1, BO.BusStation station2)
 {
     return(FollowingStationDoBoAdapter(dl.GetFollowingStations(
                                            BusStationBoDoAdapter(station1), BusStationBoDoAdapter(station2))));
 }