public DO.LineStation LineStationBoDoAdapter(BO.LineStation LineStationBO) { DO.LineStation LineStationDO = new DO.LineStation(); LineStationBO.CopyPropertiesTo(LineStationDO); LineStationDO.StationCode = LineStationBO.Station.Code; return(LineStationDO); }
public void AddLineStation(BO.LineStation s) { try { dl.AddLineStation(LineStationBoDoAdapter(s)); } catch (DO.BadLineStationKeyException ex) { } }
/// <summary> /// Update manually time and distance between two stations /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">e of the argument</param> private void UpdateTimeDistance(object sender, RoutedEventArgs e) { Button bt = sender as Button; BO.LineStation firstSt = bt.DataContext as BO.LineStation; var lst = lineStations.ToList <BO.LineStation>(); int ind = lst.FindIndex(st => st.Code == firstSt.Code); if (ind == lst.Count - 1) // when try to update the last station { MessageBox.Show("Cannot update time & distance to last station!", "Wrong action", MessageBoxButton.OK, MessageBoxImage.Error); } else { BO.LineStation secSt = lst[ind + 1]; UpdateTimeAndDistance win = new UpdateTimeAndDistance(firstSt, secSt); // call to UpdateTimeAndDistance window for update the date there win.ShowDialog(); UpdateData(); } }
/// <summary> /// delete station from the line /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">e of the argument</param> private void Delete_station(object sender, RoutedEventArgs e) { try { if (bl.IsTwoStationsInLine(curBusLine.DOLineId)) // delete station cause to delete the line because it one of the last tow station of the line { var answer = MessageBox.Show(string.Format("Are you sure you want to delete? this line will be deleted!"), "Attention!", MessageBoxButton.YesNo, MessageBoxImage.Warning); // jumping massage box of warning if (answer == MessageBoxResult.Yes) // when the user aprove the delete, delete the line { bl.DeleteBusLine(curBusLine); this.Closing -= UpdateArea; // no needing event if line is being deleted this.Close(); } } else // the station to delete not one of the two last stations of the line { Button bt = sender as Button; BO.LineStation stToDelete = bt.DataContext as BO.LineStation; bl.DeleteLineStation(stToDelete); UpdateData(); // updating the data of the window } } catch (BO.BusLineExists ex) // the line already exist in bl { MessageBox.Show(ex.Message + string.Format(" wrong line:{0}", ex.LineNumber), "Data error", MessageBoxButton.OK, MessageBoxImage.Error); } catch (BO.BusLineNotFound ex) // can't find the line in bl { MessageBox.Show(ex.Message + string.Format(" wrong line:{0}", ex.LineNumber), "Data error", MessageBoxButton.OK, MessageBoxImage.Error); } catch (BO.StationExists ex) // the station already exist in bl { MessageBox.Show(ex.Message + string.Format(" wrong station:{0}", ex.Code), "Data error", MessageBoxButton.OK, MessageBoxImage.Error); } catch (BO.StationNotFound ex) // can't find the station in bl { MessageBox.Show(ex.Message + string.Format(" wrong station:{0}", ex.Code), "Data error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private BO.LineStation LineStationDoToBo(DO.LineStation doLineStation, BO.LineStation prevStation = null) { if (prevStation != null) { try { var doAdjStations = dl.GetAdjacentStations(prevStation.Station.Code, doLineStation.StationCode); prevStation.Distance = doAdjStations.Distance; prevStation.DrivingTime = doAdjStations.AverageTime; } catch (DO.BadLineStationKeyException) { } } return(new BO.LineStation { Station = GetStation(doLineStation.StationCode), DrivingTime = TimeSpan.Zero, Distance = 0, ID = doLineStation.ID, LineId = doLineStation.LineId, IndexInLine = doLineStation.IndexInLine }); }
public LineStation(LineStation line_Station) //not implemented { Valid = true; Code = line_Station.Code; NumberInLine = line_Station.NumberInLine; }
public void DeleteLineStation(BO.LineStation lineStation) { dl.DeleteLineStation(LineStationBoDoAdapter(lineStation)); }
public void UpdateLineStation(BO.LineStation lineStation) { dl.UpdateLineStation(LineStationBoDoAdapter(lineStation)); }
public void AddLineStation(BO.LineStation lineStation) { dl.AddLineStation(LineStationBoDoAdapter(lineStation)); }
DO.LineStation LineStationBoDoAdapter(BO.LineStation lineStationBo) { DO.LineStation lineStationDo = new DO.LineStation(); lineStationBo.CopyPropertiesTo(lineStationDo); return(lineStationDo); }
BO.LineStation LineStationDoBoAdapter(DO.LineStation lineStationDo) { BO.LineStation lineStationBo = new BO.LineStation(); lineStationDo.CopyPropertiesTo(lineStationBo); return(lineStationBo); }
public DigitalScreen(BusTravel currentBusTravel, LineStation currentLineStation, TimeSpan currentTime) { CurrentBusTravel = currentBusTravel; CurrentLineStation = currentLineStation; CurrentTime = currentTime; }