/// <summary>
 /// add station to the line after index
 /// </summary>
 /// <param name="index">the index that need to add the station after it</param>
 private void AddStation(int index)
 {
     try
     {
         string message = "";
         if (NewStationsComboBox.SelectedItem == null || ExistingStations.SelectedItem == null) // jumping massage to the user whem some data is missed
         {
             if (NewStationsComboBox.SelectedItem == null)
             {
                 message = "Please choose station to add!\n";
             }
             if (ExistingStations.SelectedItem == null)
             {
                 message += "Please choose exisiting station for index!";
             }
             MessageBox.Show(message, "Invalid input", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
             BO.Station newStation = NewStationsComboBox.SelectedItem as BO.Station;
             bl.AddLineStationToBusLine(curBusLine, newStation, index);
             UpdateData();
         }
     }
     catch (BO.MissingData ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #2
0
 private DO.Station StationFromBoToDo(BO.Station station)
 {
     DO.Station DoStation = (DO.Station)station.CopyPropertiesToNew(typeof(DO.Station));
     DoStation.Latitude  = station.Location.Latitude;
     DoStation.Longitude = station.Location.Longitude;
     return(DoStation);
 }
Пример #3
0
        private BO.Station StationFromDoToBoAdjacents(DO.Station station1)
        {
            BO.Station result = StationFromDoToBo(station1);
            IEnumerable <DO.AdjacentStations> DoAdjacents = dl.GetAllAdjacentStationsBy(ad => ad.StationCode1 == station1.Code || ad.StationCode2 == station1.Code);

            result.AdjacentStations = from item in DoAdjacents select AdjFromDoToBo(item, item.StationCode1 == station1.Code?item.StationCode2 : item.StationCode1);  //דואגים שתמיד התחנה שלנו תיהיה ראשונה בעוקבות ;//המרה של כל תחנה עוקבת

            return(result);
        }
Пример #4
0
 public void UpdateStation(BO.Station s)
 {
     //from BO to DO
     DO.Station DOstation = StationFromBoToDo(s);
     try
     {
         dl.UpdateStation(DOstation);
         foreach (var item in s.AdjacentStations)
         {
             dl.AddAdjacentStations(AdjFromBoToDo(item, s.Code));
         }
     }
     catch (DO.BadStationKeyException e)
     {
         throw new BO.BadStationKeyException(s.Code, e.Message);
     }
 }
Пример #5
0
 private BO.Station StationFromDoToBo(DO.Station station)
 {
     BO.Station BoStation = (BO.Station)station.CopyPropertiesToNew(typeof(BO.Station));
     BoStation.Location = new BO.Location(station.Latitude, station.Longitude);
     return(BoStation);
 }