Пример #1
0
 public MainWindow()
 {
     InitializeComponent();
     this.stations = new Stations();
     this.trains = new List<Train>();
     cmbBoxStation.DataContext = this.stations;
     this.dataGridLeavingTrains.DataContext = this.trains;
 }
Пример #2
0
        Stations toStation; // to station

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor that takes 6 parameters,It initializes the values
        /// </summary>
        /// <param name="number">Bus Number</param>
        /// <param name="from">From station</param>
        /// <param name="to">to station</param>
        /// <param name="time">time of departure</param>
        /// <param name="priceA">price for adult</param>
        /// <param name="priceC">price for children</param>
        public Transport(string number, Stations from, Stations to, DateTime time, decimal price,decimal priceChildren)
        {
            m_transportNumber = number;
            fromStation = from;
            toStation = to;
            timeOfTransport = time;
            priceAdult = price;
            priceChild = priceChildren;
        }
        /// <summary>
        /// Test Find using the Query class
        /// </summary>
        private void Step_30_TestFindByQuery_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                //Insert Mock Instance
                Stations mock   = CreateMockInstance(tm);
                bool     result = DataRepository.StationsProvider.Insert(tm, mock);

                Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed");

                StationsQuery query = new StationsQuery();

                query.AppendEquals(StationsColumn.Id, mock.Id.ToString());
                if (mock.Name != null)
                {
                    query.AppendEquals(StationsColumn.Name, mock.Name.ToString());
                }
                if (mock.Description != null)
                {
                    query.AppendEquals(StationsColumn.Description, mock.Description.ToString());
                }
                if (mock.Login != null)
                {
                    query.AppendEquals(StationsColumn.Login, mock.Login.ToString());
                }
                if (mock.UserId != null)
                {
                    query.AppendEquals(StationsColumn.UserId, mock.UserId.ToString());
                }
                if (mock.PosId != null)
                {
                    query.AppendEquals(StationsColumn.PosId, mock.PosId.ToString());
                }
                if (mock.Prnport != null)
                {
                    query.AppendEquals(StationsColumn.Prnport, mock.Prnport.ToString());
                }
                if (mock.Ipaddress != null)
                {
                    query.AppendEquals(StationsColumn.Ipaddress, mock.Ipaddress.ToString());
                }
                if (mock.Message != null)
                {
                    query.AppendEquals(StationsColumn.Message, mock.Message.ToString());
                }
                if (mock.Serialkey != null)
                {
                    query.AppendEquals(StationsColumn.Serialkey, mock.Serialkey.ToString());
                }
                query.AppendEquals(StationsColumn.Status, mock.Status.ToString());

                TList <Stations> results = DataRepository.StationsProvider.Find(tm, query);

                Assert.IsTrue(results.Count == 1, "Find is not working correctly.  Failed to find the mock instance");
            }
        }
Пример #4
0
        public static void Show(string station)
        {
            Stations stations = transport.GetStations(station);

            if (stations.StationList.Count != 0)
            {
                MapForm mapForm = new MapForm(stations.StationList[0].Coordinate.XCoordinate, stations.StationList[0].Coordinate.YCoordinate);
                mapForm.Show();
            }
        }
Пример #5
0
        /// <summary>
        /// Method gets the coordinates of the Start Station.
        /// </summary>
        /// <param name="Station"></param>
        /// <returns> Connections </returns>
        public string GetStationCoordinates(string Station)
        {
            Stations stations = transportAPI.GetStations(Station);

            if (stations.StationList[0].Coordinate == null)
            {
                throw new Exception("Der Standort der Station " + Station + " konnte nicht gefunden werden.");
            }
            return(stations.StationList[0].Coordinate.XCoordinate.ToString().Replace(',', '.') + "," + stations.StationList[0].Coordinate.YCoordinate.ToString().Replace(',', '.'));
        }
Пример #6
0
        public void FillStationListView(Stations stations)
        {
            string currStation = stations.StationList.First().Name;

            abfahrtStationListView.Items.Clear();
            foreach (Station station in stations.StationList)
            {
                abfahrtStationListView.Items.Add(currStation, station.Name, station.Distance + " m");
            }
        }
Пример #7
0
        private void textboxvon_KeyUp(object sender, KeyEventArgs e)
        {
            listBox1.Items.Clear();
            Stations resultat = transport.GetStations(textboxvon.Text);

            foreach (Station station in resultat.StationList)
            {
                listBox1.Items.Add(station.Name);
            }
        }
Пример #8
0
        private void FahrplanButton_Click(object sender, EventArgs e)
        {
            Stations         Abfahrtsplan     = _transport.GetStations(query: StartstationsText.Text);
            Abfahrtsplanform abfahrtsplanform = new Abfahrtsplanform(Abfahrtsplan, _transport);

            if (Abfahrtsplan.StationList.Count != 0)
            {
                abfahrtsplanform.ShowDialog();
            }
        }
Пример #9
0
        //Vorschläge in der listbox
        private void tBnach_KeyPress(object sender, KeyPressEventArgs e)
        {
            listBox3.Items.Clear();
            Stations myStations = t.GetStations(tBvon.Text);

            foreach (Station station in myStations.StationList)
            {
                listBox3.Items.Add(station.Name);
            }
        }
Пример #10
0
 public void AddStations(ICollection <ServiceStation> stations)
 {
     foreach (ServiceStation station in stations)
     {
         if (StationExistsByName(station) == null)
         {
             Stations.Add(new RouteStationMapper().MapFrom(station));
         }
     }
 }
Пример #11
0
        private void EingabeZielstation_KeyUp(object sender, KeyEventArgs e)
        {
            EingabeVollständigkeitsPrüfung(e);
            Stations Zielstation = transport.GetStations(EingabeZielstation.Text);

            foreach (Station x in Zielstation.StationList)
            {
                EingabeZielstation.Items.Add(x.Name);
            }
        }
Пример #12
0
        public void PostStation(Stations station)
        {
            HttpClient Client = new HttpClient();

            Client.BaseAddress = new Uri("http://localhost:65046/Moslah/Station/CreateStation");
            Client.DefaultRequestHeaders.Clear();
            Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            var result = Client.PostAsJsonAsync <Stations>("", station).Result;
            // return RedirectToAction("GetAllNews");
        }
Пример #13
0
        public static void StationAtGoogleMaps(string Station)
        {
            Transport m_transport = new Transport();
            Stations  stations    = new Stations();

            stations = m_transport.GetStations(Station);
            string coordinate = stations.StationList.First().Coordinate.XCoordinate.ToString() + "," + stations.StationList.First().Coordinate.YCoordinate.ToString();

            System.Diagnostics.Process.Start("https://www.google.ch/maps?q=" + coordinate + "&t=k&z=21");
        }
Пример #14
0
 // x und y koordinaten holen
 private void Maps_Load(object sender, EventArgs e)
 {
     if (ort != null)
     {
         Stations stations = transport.GetStations(ort);
         Station  station  = stations.StationList[0];
         Create_GmapStation(Convert.ToString(station.Coordinate.XCoordinate).Replace(',', '.'),
                            Convert.ToString(station.Coordinate.YCoordinate).Replace(',', '.'));
     }
 }
Пример #15
0
        private void FillDataGridView(Stations stations)
        {
            string yourGps = stations.StationList.First().Name.ToString();                              // DataGrid mit den Stationen füllen

            NearbyStationdataGridView.Rows.Clear();
            foreach (Station station in stations.StationList)
            {
                NearbyStationdataGridView.Rows.Add(yourGps, station.Name, station.Distance + " m");
            }
        }
        private void GetStation(AudioAnalyzerConfigurationMonitorIDStation station)
        {
            Station stationSend = new Station();

            stationSend.StationID    = station.StationID;
            stationSend.StationName  = station.StationName;
            stationSend.ListOfMeters = new List <Meter>();
            GetMeters(station, stationSend, station.MeterID.Count());
            Stations.Add(stationSend);
        }
        /// <summary>
        /// Check the foreign key dal methods.
        /// </summary>
        private void Step_10_FK_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                Stations entity = CreateMockInstance(tm);
                bool     result = DataRepository.StationsProvider.Insert(tm, entity);

                Assert.IsTrue(result, "Could Not Test FK, Insert Failed");
            }
        }
        // Click event
        private void searchStationByName(object sender, RoutedEventArgs e)
        {
            Stations stations = apiSearches.searchForStation(comboBoxStationSearchValue.Text);

            // If validation failed
            if (stations != null)
            {
                displayStationsOnListBox(stations);
            }
        }
Пример #19
0
        /// <summary>
        ///     Create RadioBrowser instance
        /// </summary>
        /// <param name="apiUrl">Optional custom API URL</param>
        /// <param name="customUserAgent">Optional custom user agent</param>
        public RadioBrowserClient(string apiUrl = null, string customUserAgent = null)
        {
            var converters = new Converters();

            HttpClient = new HttpClient(apiUrl, customUserAgent);
            Search     = new Search(HttpClient, converters);
            Lists      = new Lists(HttpClient, converters);
            Stations   = new Stations(HttpClient, converters);
            Modify     = new Modify(HttpClient, converters);
        }
Пример #20
0
 private bool SearchTimetableErrors(Stations stationsOfTimetableLocation)
 {
     if (stationsOfTimetableLocation.StationList.Count() == 0)
     {
         lblTimetableErrors.Visible = true;
         lblTimetableErrors.Text    = "Es wurde keine Station mit dem Namen " + txtTimetableLocation.Text + " gefunden.";
         return(true);
     }
     return(false);
 }
Пример #21
0
 //Near me
 public void FillDataGridNearMe(Stations stations, DataGridView dataGridView)
 {
     dataGridView.Rows.Clear();
     foreach (Station station in stations.StationList)
     {
         dataGridView.Rows.Add(
             station.Name,
             station.Distance + "m"
             );
     }
 }
Пример #22
0
        public void UnitTestExample_ExpectedIsBob_ReturnsTrue()
        {
            //Arrange
            var station = new Stations();

            //Act
            bool result = station.UnitTestExample("Bob");

            //Assert
            Assert.IsTrue(result);
        }
Пример #23
0
 public void UpdateStation(QueueNotification notification)
 {
     App.Current.Dispatcher.Invoke(() =>
     {
         var station = Stations.Where(s => s.StationNumber == notification.StationNumber).FirstOrDefault();
         if (station != null)
         {
             station.PatientNumber = notification.UserNumber;
         }
     });
 }
Пример #24
0
        private void textBoxNach_TextChanged(object sender, EventArgs e)
        {
            //anzeigen von vorschlägen
            listBoxDropDownNach.Items.Clear();
            Stations Vorschlag = transport.GetStations(textBoxNach.Text);

            foreach (Station station in Vorschlag.StationList)
            {
                listBoxDropDownNach.Items.Add(station.Name);
            }
        }
        /// <summary>
        /// Test methods exposed by the EntityHelper class.
        /// </summary>
        private void Step_20_TestEntityHelper_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);

                Stations entity = mock.Copy() as Stations;
                entity = (Stations)mock.Clone();
                Assert.IsTrue(Stations.ValueEquals(entity, mock), "Clone is not working");
            }
        }
Пример #26
0
        public MySwissTransport()
        {
            InitializeComponent();

            stations        = new Stations();
            connections     = new Connections();
            transport       = new Transport();
            stationBoard    = new StationBoardRoot();
            connection      = new Connection();
            connectionpoint = new ConnectionPoint();
        }
Пример #27
0
        private void SearchDeparture(string stationname, ListView listViewName)
        {
            listViewName.Items.Clear();
            Stations myStations = t.GetStations(stationname);

            foreach (Station station in myStations.StationList)
            {
                ListViewItem item = listViewName.Items.Add(station.Id);
                item.SubItems.Add(station.Name);
            }
        }
Пример #28
0
        public async Task <IActionResult> Create([Bind("id,number,pole,available_bikes,code_insee,lng,availability,availabilitycode,etat,startdate,langue,bike_stands,last_update,available_bike_stands,gid,titre,status,commune,description,nature,bonus,address2,address,lat,last_update_fme,enddate,name,banking,nmarrond")] Stations stations)
        {
            if (ModelState.IsValid)
            {
                _context.Add(stations);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(stations));
        }
Пример #29
0
 public void GetGroupStations()
 {
     GroupStations = Stations
                     .GroupBy(s => s.City)
                     .Select(g => new GroupStation
     {
         City     = g.Key,
         Stations = g.ToList()
     })
                     .ToList();
 }
 public IEnumerable <Measurements> FindAllMeasurementsByStationInTimeInterval(Stations station, DateTime begin, DateTime end)
 {
     return(template.Query("select * from Measurements where Station=@station and Timestamp>=@begin and Timestamp<=@end",
                           measurementMapper,
                           new[]
     {
         new SqlParameter("@station", station.Station),
         new SqlParameter("@begin", begin),
         new SqlParameter("@end", end)
     }));
 }
        public ReportProductsStocksTransactions()
        {
            Products = new List <ProductsTransactions>();
            Station  = new Stations();
            Product  = new Products();
            Codes    = new List <SelectListItem>();
            Items    = new List <SelectListItem>();

            Start = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToString("d MMMM, yyyy");
            Ended = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1).ToString("d MMMM, yyyy");
        }
Пример #32
0
 private void addall_Click(object sender, EventArgs e)
 {
     while (Names.Count > 0)
     {
         Stations addstations = new Stations();
         addstations.StationName = Names.Dequeue();
         db.stations.Add(addstations);
         db.SaveChanges();
     }
     updateStatus();
 }
Пример #33
0
        /// <summary>
        /// When the refresh button is pressed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLoad_Click(object sender, RoutedEventArgs e)
        {
            this.ShowInStatusBar("Loading station data from web.");
            new Action(async () =>
            {
                try
                {
                    this.stations = await Task.Run<Stations>(() => TrainDataProvider.GetStations());
                    cmbBoxStation.DataContext = this.stations;
                    this.ShowInStatusBar("Station data loaded.");
                }
                catch (Exception ex)
                {
                    this.ShowInStatusBar(ex.Message);
                }

            }).Invoke();
        }
Пример #34
0
 public StationSelectMsg( Allegiance allegiance, Stations station)
 {
     this.allegiance = allegiance;
     this.station = station;
 }
Пример #35
0
 public void OnStationDropdownChanged(int changedTo)
 {
     this.stationSelected = (Stations) changedTo;
     CoreNetwork.Instance.Send( new StationSelectMsg( Global.Allegiance,  this.stationSelected ));
 }
Пример #36
0
    void FreeStation(Allegiance all, Stations station)
    {
        Image[] stationIndictators;
        int[] stationsTaken;
        if (all == Allegiance.Pirates)
        {
            stationIndictators = PiratesStationsIndicatiors;
            stationsTaken = piratesStationsTaken;
        }
        else
        {
            stationIndictators = SecurityStationsIndicators;
            stationsTaken = securityStationsTaken;
        }

        stationIndictators[ (int) station].color = Color.white;
        stationsTaken[ (int) station ] = -1; 
    }
Пример #37
0
    void TakeStation(Allegiance all, Stations station, int connectionId)
    {
        Image[] stationIndictators;
        int[] stationsTaken;
        if (all == Allegiance.Pirates)
        {
            stationIndictators = PiratesStationsIndicatiors;
            stationsTaken = piratesStationsTaken;
        }
        else
        {
            stationIndictators = SecurityStationsIndicators;
            stationsTaken = securityStationsTaken;
        }

        stationIndictators[ (int) station].color = Color.green;
        stationsTaken[ (int) station ] = connectionId;
    }
Пример #38
0
 /// <summary>
 /// Constructor that takes 6 parameters, It calls the base class contructor
 /// to set the values
 /// </summary>
 /// <param name="number">Bus Number</param>
 /// <param name="from">From station</param>
 /// <param name="to">to station</param>
 /// <param name="time">time of departure</param>
 /// <param name="priceA">price for adult</param>
 /// <param name="priceC">price for children</param>
 public Bus(string number,Stations from,Stations to, DateTime time, decimal priceA,decimal priceC)
     : base(number,from,to,time,priceA,priceC)
 {
 }