public static StationForecast CreateStationForecastFromRealTimeInfo(RealTimeInfo realTimeInfo, Stations stations) { if (realTimeInfo == null) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Argument '{0}' is null.", nameof(realTimeInfo))); } if (stations == null) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Argument '{0}' is null.", nameof(stations))); } List <TramXml> inboundForecasts = realTimeInfo.Directions.FirstOrDefault(d => d.DirectionName == "Inbound").Trams; List <TramXml> outboundForecasts = realTimeInfo.Directions.FirstOrDefault(d => d.DirectionName == "Outbound").Trams; StationForecast stationForecast = new StationForecast { Station = stations.GetStation(realTimeInfo.StopAbbreviation), Message = realTimeInfo.Message, Created = realTimeInfo.Created, InboundTrams = inboundForecasts.Select(tram => TramForecast.CreateTramForecastFromTramXml(tram, stations)).Where(forecast => forecast != null).ToList(), OutboundTrams = outboundForecasts.Select(tram => TramForecast.CreateTramForecastFromTramXml(tram, stations)).Where(forecast => forecast != null).ToList() }; return(stationForecast); }
private void SetSecondStation(int selectedStationId) { if (selectedStationId != Ticket.startStation.id) { Ticket.endStation = Stations.GetStation(selectedStationId); //PageControl.ShowPage(Pages.cardOperationPage); } }
public void GetStation_StationNotFound_ThrowsException() { UnitTestStationInformationLoader loader = new UnitTestStationInformationLoader(); Stations stations = new Stations(loader); Assert.Throws <StationNotFoundException>(() => stations.GetStation("STS")); }
public void GetStation_NullAbbreviation_ThrowsArgumentException() { UnitTestStationInformationLoader loader = new UnitTestStationInformationLoader(); Stations stations = new Stations(loader); Assert.Throws <ArgumentException>(() => stations.GetStation(null)); }
public void GetStation_WhiteSpaceAbbreviation_ThrowsArgumentException() { UnitTestStationInformationLoader loader = new UnitTestStationInformationLoader(); Stations stations = new Stations(loader); Assert.Throws <ArgumentException>(() => stations.GetStation(string.Empty)); }
public void GetStation_LowercaseQueryStationExists_ReturnsStation() { UnitTestStationInformationLoader loader = new UnitTestStationInformationLoader(); Station station = new Station { Name = "St. Stephen's Green", Abbreviation = "STS" }; loader.AddStations(station); Stations stations = new Stations(loader); Assert.Equal(station, stations.GetStation(station.Abbreviation.ToLowerInvariant())); }
private void SetEndStation(int selectedStationId) { if (selectedStationId != Stations.currentStation.id) { string tmp = MultiLanguage.GetCurrentLanguage(); MultiLanguage.ChangeLanguage("EN"); Stations.FillStationList(); Ticket.endStation = Stations.GetStation(selectedStationId); Ticket.startStation = Stations.currentStation; MultiLanguage.ChangeLanguage(tmp); Stations.FillStationList(); //PageControl.ShowPage(Pages.journeyPage); } }
private void btnStation_Click(object sender, RoutedEventArgs e) { TVMUtility.PlayClick(); int selectedStationId = 0; selectedStationId = Convert.ToInt32(((Button)sender).Tag.ToString());//Stations.GetStation().id; //if (Stations.stationList.ContainsKey(selectedStationId)) // SetStation(selectedStationId); Ticket.endStation = Stations.GetStation(selectedStationId); Ticket.startStation = Stations.currentStation; ElectronicJournal.DestinationSelected(Ticket.endStation.name.ToString()); Constants.IsMapPageActive = false; NavigationService.Navigate(new Pages.TicketCountPage()); //PageControl.ShowPage(Pages.journeyPage); }
private void SetEndStation(int selectedStationId) { if (selectedStationId != Stations.currentStation.id) { Ticket.endStation = Stations.GetStation(selectedStationId); Ticket.startStation = Stations.currentStation; ElectronicJournal.DestinationSelected(Ticket.endStation.name.ToString()); Constants.IsMapPageActive = true; NavigationService.Navigate(new Pages.TicketCountPage()); //PageControl.ShowPage(Pages.journeyPage); } else { lblWarning.Visibility = Visibility.Visible; lblWarning.Content = "This station can not be selected!"; } }
public void GetStation_MoreThanOneStationAvailable_ReturnsCorrectStation() { UnitTestStationInformationLoader loader = new UnitTestStationInformationLoader(); Station alternativeStation = new Station { Name = "Harcourt", Abbreviation = "HAR" }; Station stationToQuery = new Station { Name = "St. Stephen's Green", Abbreviation = "STS" }; loader.AddStations(alternativeStation, stationToQuery); Stations stations = new Stations(loader); Assert.Equal(stationToQuery, stations.GetStation(stationToQuery.Abbreviation)); }
private void SetFirstStation(int selectedStationId) { Ticket.mapHeaderType = MapHeaderType.Station2; Ticket.startStation = Stations.GetStation(selectedStationId); SetHeaderText(); }
private void Page_Loaded(object sender, RoutedEventArgs e) { try { initialTimer(); LedOperations.GreenText("Select Destination"); Message(); btnBack.Content = MultiLanguage.GetText("back"); btnFinish.Content = MultiLanguage.GetText("cancel"); btnStationList.Content = MultiLanguage.GetText("showStationList"); lblDestination.Content = MultiLanguage.GetText("DispDestination"); lblNoOfTickets.Content = MultiLanguage.GetText("DispNoOfTickets"); lblAmount.Content = MultiLanguage.GetText("DispAmount"); SetHeaderText(); SetDefaultStatus(); ListStationsInGrid(); switch (Ticket.journeyType) { case JourneyType.SJT: lblType.Content = MultiLanguage.GetText("SJT"); break; case JourneyType.RJT: lblType.Content = MultiLanguage.GetText("RJT"); break; case JourneyType.Group_Ticket: lblType.Content = MultiLanguage.GetText("GRO"); break; case JourneyType.Day_Pass: lblType.Content = MultiLanguage.GetText("onedaypass"); break; case JourneyType.Weekend_Pass: lblType.Content = MultiLanguage.GetText("weekenddaypass"); break; } btnStation1.Content = MultiLanguage.GetText(Stations.GetStation(1).description); btnStation2.Content = MultiLanguage.GetText(Stations.GetStation(2).description); btnStation3.Content = MultiLanguage.GetText(Stations.GetStation(3).description); btnStation4.Content = MultiLanguage.GetText(Stations.GetStation(4).description); btnStation5.Content = MultiLanguage.GetText(Stations.GetStation(5).description); btnStation6.Content = MultiLanguage.GetText(Stations.GetStation(6).description); btnStation7.Content = MultiLanguage.GetText(Stations.GetStation(7).description); btnStation8.Content = MultiLanguage.GetText(Stations.GetStation(8).description); btnStation9.Content = MultiLanguage.GetText(Stations.GetStation(9).description); btnStation10.Content = MultiLanguage.GetText(Stations.GetStation(10).description); btnStation11.Content = MultiLanguage.GetText(Stations.GetStation(11).description); btnStation12.Content = MultiLanguage.GetText(Stations.GetStation(12).description); btnStation13.Content = MultiLanguage.GetText(Stations.GetStation(13).description); btnStation14.Content = MultiLanguage.GetText(Stations.GetStation(14).description); btnStation15.Content = MultiLanguage.GetText(Stations.GetStation(15).description); btnStation16.Content = MultiLanguage.GetText(Stations.GetStation(16).description); btnStation17.Content = MultiLanguage.GetText(Stations.GetStation(17).description); btnStation18.Content = MultiLanguage.GetText(Stations.GetStation(18).description); btnStation19.Content = MultiLanguage.GetText(Stations.GetStation(19).description); btnStation20.Content = MultiLanguage.GetText(Stations.GetStation(20).description); btnStation21.Content = MultiLanguage.GetText(Stations.GetStation(21).description); btnStation22.Content = MultiLanguage.GetText(Stations.GetStation(22).description); } catch (Exception ex) { log.Error("Error StationMapPage -> Page_Loaded() : " + ex.ToString()); } }
private bool ArrangTicketInfo() { bool result = false; try { switch (Ticket.journeyType) { case JourneyType.Topup: lblLine1Key.Visibility = Visibility.Visible; lblLine2Key.Visibility = Visibility.Visible; lblLine2Value.Visibility = Visibility.Visible; lblLine1Key.Content = Ticket.journeyTypeText; lblLine2Key.Content = MultiLanguage.GetText("amount"); lblLine2Value.Content = Conversion.MoneyFormat(TransactionInfo.amount); break; case JourneyType.Day_Pass: case JourneyType.Weekend_Pass: lblLine1Key.Visibility = Visibility.Visible; lblLine2Key.Visibility = Visibility.Visible; lblLine2Value.Visibility = Visibility.Visible; lblLine3Key.Visibility = Visibility.Visible; lblLine3Value.Visibility = Visibility.Visible; lblLine4Key.Visibility = Visibility.Visible; lblLine4Value.Visibility = Visibility.Visible; lblLine1Key.Content = Ticket.journeyTypeText; lblLine2Key.Content = MultiLanguage.GetText("ticketType"); lblLine2Value.Content = MultiLanguage.GetText("RFIDPaper"); lblLine3Key.Content = MultiLanguage.GetText("numberOfTickets"); lblLine3Value.Content = Ticket.ticketCount; lblLine4Key.Content = MultiLanguage.GetText("amount"); lblLine4Value.Content = Conversion.MoneyFormat(Ticket.totalPrice); lblType.Content = Ticket.journeyTypeText.ToString(); lblDestination.Visibility = Visibility.Collapsed; arrorDest.Visibility = Visibility.Collapsed; lblNoOfTickets.Content = Ticket.ticketCount; lblAmount.Content = Conversion.MoneyFormat(Ticket.totalPrice); break; case JourneyType.Period_Pass: case JourneyType.Trip_Pass: lblLine1Key.Visibility = Visibility.Visible; lblLine2Key.Visibility = Visibility.Visible; lblLine2Value.Visibility = Visibility.Visible; lblLine3Key.Visibility = Visibility.Visible; lblLine3Value.Visibility = Visibility.Visible; lblLine4Key.Visibility = Visibility.Visible; lblLine4Value.Visibility = Visibility.Visible; lblLine5Key.Visibility = Visibility.Visible; lblLine5Value.Visibility = Visibility.Visible; lblLine6Key.Visibility = Visibility.Visible; lblLine6Value.Visibility = Visibility.Visible; lblLine1Key.Content = Ticket.journeyTypeText; lblLine2Key.Content = "Origin Station :"; lblLine2Value.Content = MultiLanguage.GetText(Ticket.startStation.name); lblLine3Key.Content = MultiLanguage.GetText("destination"); lblLine3Value.Content = Ticket.endStation.name; lblLine4Key.Content = "Number Of Pass : "******"Validity : "; lblLine5Value.Content = Ticket.ticketExpiryDts.ToString("g"); lblLine6Key.Content = MultiLanguage.GetText("amount"); lblLine6Value.Content = Conversion.MoneyFormat(Ticket.totalPrice); break; case JourneyType.Group_Ticket: lblLine1Key.Visibility = Visibility.Visible; lblLine2Key.Visibility = Visibility.Visible; lblLine2Value.Visibility = Visibility.Visible; lblLine3Key.Visibility = Visibility.Visible; lblLine3Value.Visibility = Visibility.Visible; lblLine4Key.Visibility = Visibility.Visible; lblLine4Value.Visibility = Visibility.Visible; lblLine5Key.Visibility = Visibility.Visible; lblLine5Value.Visibility = Visibility.Visible; lblLine1Key.Content = Ticket.journeyTypeText; lblLine2Key.Content = MultiLanguage.GetText("destination"); lblLine2Value.Content = MultiLanguage.GetText(Ticket.endStation.name); lblLine3Key.Content = MultiLanguage.GetText("ticketType"); lblLine3Value.Content = Ticket.ticketTypeText; lblLine4Key.Content = "Number Of Passenger : "; lblLine4Value.Content = Ticket.peopleCount; lblLine5Key.Content = MultiLanguage.GetText("amount"); lblLine5Value.Content = Conversion.MoneyFormat(Ticket.totalPrice); lblType.Content = Ticket.journeyTypeText.ToString(); lblDestination.Content = MultiLanguage.GetText(Ticket.endStation.name); lblNoOfTickets.Content = Ticket.ticketCount; lblAmount.Content = Conversion.MoneyFormat(Ticket.totalPrice); break; case JourneyType.RJT: case JourneyType.SJT: lblLine1Key.Content = Ticket.journeyTypeText; lblLine2Key.Content = MultiLanguage.GetText("destination"); lblLine2Value.Content = MultiLanguage.GetText(Stations.GetStation(Ticket.endStation.id).name); //lblLine3Key.Content = "Ticket Type :"; lblLine3Value.Content = Ticket.ticketTypeText; lblLine3Key.Content = MultiLanguage.GetText("numberOfTickets"); lblLine3Value.Content = Ticket.ticketCount; lblLine4Key.Content = MultiLanguage.GetText("amount"); lblLine4Value.Content = Conversion.MoneyFormat(Ticket.totalPrice); Constants.EnableBillNotes = TVMUtility.EnableBill(Ticket.totalPrice); lblType.Content = Ticket.journeyTypeText.ToString(); lblDestination.Content = MultiLanguage.GetText(Ticket.endStation.name); lblNoOfTickets.Content = Ticket.ticketCount; lblAmount.Content = Conversion.MoneyFormat(Ticket.totalPrice); break; default: break; } result = true; } catch (Exception ex) { result = false; } return(result); }