Ejemplo n.º 1
0
        public void Update_Valid()
        {
            //arange
            DeparturesService service = new DeparturesService(unitOfWork, mapper, validator);

            var expected = new Departure
            {
                Id = 1, FlightId = 1, FlightNumber = "QW11", DepartureTime = Convert.ToDateTime("2018-07-13T08:22:56.6404304+03:00")
            };

            var DtoToMake = new DepartureDto
            {
                Id = 1, FlightId = 1, FlightNumber = "QW11", DepartureTime = Convert.ToDateTime("2018-07-13T08:22:56.6404304+03:00")
            };


            //act
            service.Update(DtoToMake);

            var actual = (unitOfWork.Set <Departure>() as FakeRpository <Departure>).updatedItem;

            //assert
            Assert.AreEqual(expected.Id, actual.Id);
            Assert.AreEqual(expected.FlightId, actual.FlightId);
            Assert.AreEqual(expected.FlightNumber, actual.FlightNumber);
            Assert.AreEqual(expected.DepartureTime, actual.DepartureTime);
        }
        async void Delete()
        {
            await _departureService.Delete(Departure.Id);

            Departure = new Departure();
            await LoadDepartures().ConfigureAwait(false);
        }
Ejemplo n.º 3
0
        public async Task <HttpStatusCode> CreateDepartureAsync(Departure departure)
        {
            var result = await httpclient.PostAsJsonAsync(path, departure).ConfigureAwait(false);

            result.EnsureSuccessStatusCode();
            return(result.StatusCode);
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> PutDeparture(int routenum, Departure departure)
        {
            if (routenum != departure.RouteNum)
            {
                return(BadRequest());
            }

            _context.Entry(departure).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DepartureExists(routenum))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 5
0
 private string GetTimezone(List <Agency> agencies, List <Stop> stops, Departure departure, string defaultTimezone = "Etc/UTC")
 {
     return(StringUtils.FindPossibleString(defaultTimezone,
                                           () => stops.FirstOrDefault(s => s.Id == departure.StopId)?.Timezone,
                                           () => agencies.FirstOrDefault(a => a.Id == departure.AgencyId)?.Timezone,
                                           () => agencies.FirstOrDefault()?.Timezone));
 }
Ejemplo n.º 6
0
        public void SheduleDepartureTest_When_Flight_NotExist_And_Flight_IsDefined_Then_Throw_Exception()
        {
            // Arrange
            var  aircraftMock = new Mock <IAircraftService>();
            var  crewingMock  = new Mock <ICrewingService>();
            var  flightOpMock = new Mock <IFlightOperationsService>();
            long flightId     = 1;

            flightOpMock.SetupSequence(e => e.GetFlightInfo(flightId)).Returns(default(Flight));

            var service = new AiroportService(aircraftMock.Object, crewingMock.Object, flightOpMock.Object);

            var departure = new Departure()
            {
                CrewId        = 1,
                DepartureTime = new DateTime(2018, 8, 10, 11, 0, 0),
                PlaneId       = 1,
                Flight        = new Flight()
                {
                    Id = flightId
                }
            };

            // act
            // assert
            Assert.Throws <ArgumentException>(new TestDelegate(() =>
            {
                service.SheduleDeparture(departure);
            }));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> TSASpecs(Departure model)
        {
            AirportCode newModel = new AirportCode();

            newModel.Code = model.iata;
            return(View(newModel));
        }
Ejemplo n.º 8
0
        public void Add_post()
        {
            var departure = new Departure
            {
                DepartureId = 4
            };

            var controller = new DepartureController(
                new DepartureBLL(new DepartureRepositoryStab()),
                new LineBLL(new LineRepositoryStab())
                );

            var sessionMock = new TestControllerBuilder();

            sessionMock.InitializeController(controller);
            controller.Session["AuthenticatedUser"] = new DbUser
            {
                Username = "******",
                Password = null,
                Salt     = null
            };
            var actionResult = (RedirectToRouteResult)controller.Add(departure, 4);

            Assert.IsNotNull(actionResult, "Not a redirect result");
            Assert.IsFalse(actionResult.Permanent);
            Assert.AreEqual("Index", actionResult.RouteValues["Action"]);
            Assert.AreEqual(2, actionResult.RouteValues.Count());
        }
Ejemplo n.º 9
0
        public void TestInitialize()
        {
            try {
                StreamReader testFileReader = new StreamReader(filePath, System.Text.Encoding.Default);
                data = testFileReader.ReadToEnd();
                testFileReader.Close();
            } catch (Exception) {
                //TODO
            }

            deserializer = new JavaScriptSerializer();

            response = deserializer.Deserialize <Response>(data);

            List <Monitor> monitors     = response.Data.Monitors;
            Monitor        firstMonitor = monitors.First();
            List <Line>    lines        = firstMonitor.Lines;

            firstLine = lines.First();
            Departures       departures      = firstLine.Departures;
            List <Departure> departure       = departures.Departure;
            Departure        firstDeparture  = departure.First();
            Departure        secondDeparture = departure.ElementAt(1);

            departureTime1 = firstDeparture.DepartureTime;
            departureTime2 = secondDeparture.DepartureTime;
        }
Ejemplo n.º 10
0
        async void Delete()
        {
            await Departureservice.Delete(Departure.Id);

            Departure = new Departure();
            await LoadEntity().ConfigureAwait(false);
        }
        private void departureList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Departure selected = (Departure)Departure.SelectedItem;

            splitView.DataContext = selected;
            splitView.IsPaneOpen  = !splitView.IsPaneOpen;
        }
        public DepartureDTO AddDeparture(DepartureDTO departure)
        {
            Validation(departure);
            Departure modelDeparture = mapper.Map <DepartureDTO, Departure>(departure);

            return(mapper.Map <Departure, DepartureDTO>(unitOfWork.Departures.Create(modelDeparture)));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Requests the next departure for the specified route, direction, stop id and route type
        /// </summary>
        /// <param name="r">Route id</param>
        /// <param name="d">Direction id</param>
        /// <param name="s">Stop id</param>
        /// <param name="t">Route type</param>
        /// <returns>The next departure in a Departure object</returns>
        public static async Task <Departure> GetNextDeparture(RouteId r, DirectionId d, RouteType t)
        {
            StopId    s         = t == RouteType.Train ? StopId.GlenferrieTrain : d == DirectionId.MelbUniViaStKilda ? StopId.GlenferrieTramMelbUni : StopId.GlenferrieTramKew;
            Departure departure = (await PTV.RequestPTVPayloadAsync($"departures/route_type/{(int)t}/stop/{(int)s}/route/{(int)r}?direction_id={(int)d}&max_results=1")).Departures[0];

            return(departure);
        }
Ejemplo n.º 14
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((Departure != null ? Departure.GetHashCode() : 0) * 397) ^ (Return != null ? Return.GetHashCode() : 0));
     }
 }
Ejemplo n.º 15
0
            public void ToUkendtAdresseIndikator_Empty_True()
            {
                var dep = new Departure();
                var ret = dep.ToUkendtAdresseIndikator();

                Assert.True(ret);
            }
Ejemplo n.º 16
0
        public void CreateEntity_Should_Create_departure_typeof_Departure()
        {
            // Arrange
            DepartureDTO departureDTO = new DepartureDTO
            {
                Id           = 1,
                CrewId       = 1,
                FlightId     = 1,
                FlightNumber = 1111,
                PlaneId      = 1,
                Time         = new DateTime(2018, 07, 12)
            };
            Departure departure = new Departure
            {
                Id           = 1,
                CrewId       = 1,
                FlightId     = 1,
                FlightNumber = 1111,
                PlaneId      = 1,
                Time         = new DateTime(2018, 07, 12)
            };

            var departureRepository = new FakeRepository <Departure>();
            var departureService    = new DepartureService(departureRepository);

            // Act
            departureService.CreateEntity(departureDTO);
            var result = departureRepository.Get(1);

            // Assert
            Assert.AreEqual(departure, result);
        }
Ejemplo n.º 17
0
        private void TickDepartures()
        {
            ListX <TransformInfo> transformInfos = GameData.Instance.transformInfoMap;
            float endDistanceSquared             = departureHyperspaceDistance * departureHyperspaceDistance;

            float deltaTime = GameTimer.Instance.deltaTime;
            int   count     = departures.Count;

            for (int i = 0; i < count; i++)
            {
                Departure     departure       = departures[i];
                TransformInfo entityTransform = transformInfos[departure.entityId];

                float distRatio = 1f - (entityTransform.DistanceToSquared(departure.endPoint) / endDistanceSquared);
                // todo -- first accelerate to top speed, then add speed + this computed speed
                float speed = (departureSpeedCurve.Evaluate(Mathf.Clamp01(distRatio)) * hyperspaceExitSpeed);
                entityTransform.position += (entityTransform.forward * speed) * deltaTime;
                Vector3 toTarget = (departure.endPoint - entityTransform.position).normalized;
                if ((Vector3.Dot(toTarget, entityTransform.forward) < 0))
                {
                    Trigger(new Evt_EntityDeparted(departure.entityId));
                }

                transformInfos[departure.entityId] = entityTransform;
            }
        }
Ejemplo n.º 18
0
 public override void AddDay(Time start)
 {
     Arrival          = Arrival.MakeAfterByAddingADay(start);
     WorkingArrival   = WorkingArrival.MakeAfterByAddingADay(start);
     Departure        = Departure.MakeAfterByAddingADay(start);
     WorkingDeparture = WorkingDeparture.MakeAfterByAddingADay(start);
 }
Ejemplo n.º 19
0
        public async Task CreateViewModel()
        {
            var model = new Departure
            {
                RunNo         = 300,
                LineType      = "SkåneExpressen",
                No            = 42,
                Name          = "42 Test",
                Towards       = "Nowhere",
                DepartureTime = DateTime.Now.AddMinutes(2)
            };


            var viewModelFactory = new DepartureViewModelFactory();
            var viewModel        = await viewModelFactory.CreateViewModelAsync(model);

            Assert.Equal(model.RunNo, viewModel.RunNo);
            Assert.Equal(model.LineType, viewModel.LineType);
            Assert.Equal(model.No, viewModel.No);
            Assert.Equal(model.Name, viewModel.Name);
            Assert.Equal(model.Towards, viewModel.Towards);
            Assert.Equal(model.DepartureTime, viewModel.Time);

            Assert.Empty(viewModel.Deviations);
        }
Ejemplo n.º 20
0
        public override void Dispose()
        {
            min.TextChanged              -= minTextChanged;
            max.TextChanged              -= maxTextChanged;
            tickPlacement.Loaded         -= tickPlacement_Loaded_1;
            orientation.Loaded           -= orientation_Loaded_1;
            orientation.SelectionChanged -= orientation_SelectionChanged;
            snapto.Loaded                 -= snapto_loaded;
            snapto.SelectionChanged       -= snapsto_OnSelectionChanged;
            this.orientation.ItemsSource   = null;
            this.tickPlacement.ItemsSource = null;
            this.snapto.ItemsSource        = null;

            if (Departure != null)
            {
                Departure.Dispose();
                Departure = null;
            }

            if (Arrival != null)
            {
                Arrival.Dispose();
                Arrival = null;
            }
            this.DataContext = null;
        }
Ejemplo n.º 21
0
 public void ExpireDeparture(Departure departure)
 {
     if (Departures.Contains(departure))
     {
         Departures.Remove(departure);
     }
 }
Ejemplo n.º 22
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((Departure != null ? Departure.GetHashCode() : 0) * 397) ^ (Arrival != null ? Arrival.GetHashCode() : 0));
     }
 }
        List <Departure> GetDepartures()
        {
            var dep1 = new Departure
            {
                Id           = 1,
                FlightNumber = "PS101",
                Airplane     = GetAirplanes().Where(x => x.Id == 2).Single(),
                Crew         = GetGrews().Where(x => x.Id == 2).Single(),
                Time         = DateTime.Now + new TimeSpan(0, 45, 45),
            };


            var dep2 = new Departure
            {
                Id           = 2,
                FlightNumber = "PS161",
                Airplane     = GetAirplanes().Where(x => x.Id == 1).Single(),
                Crew         = GetGrews().Where(x => x.Id == 1).Single(),
                Time         = DateTime.Now + new TimeSpan(0, 1, 15),
            };

            return(new List <Departure> {
                dep1, dep2,
            });
        }
Ejemplo n.º 24
0
        public override string ToString()
        {
            string departure = Departure.ToString();
            string arrival   = Arrival.ToString();

            return(StartCity + " [" + departure + "] --> " + EndCity + " [" + arrival + "]");
        }
Ejemplo n.º 25
0
        public async Task Handle(CreateNewTrip trip)
        {
            var started = new TripStarted
            {
                Day = trip.Day
            };

            var departure = new Departure
            {
                Day   = trip.Day,
                State = trip.State
            };

            var travel = new Travel
            {
                Day       = trip.Day,
                Movements = new List <Movement>(trip.Movements)
            };

            // This will create a new event stream and
            // append the three events to that new stream
            // when the IDocumentSession is saved
            var action = _session.Events
                         .StartStream(started, departure, travel);

            // You can also use strings as the identifier
            // for streams
            var tripId = action.Id;

            // Commit the events to the new event
            // stream for this trip
            await _session.SaveChangesAsync();
        }
Ejemplo n.º 26
0
        public void Create_When_entity_is_invalid_Then_bad_request_exception_is_thrown()
        {
            // Arrange
            var departureMock = new Departure()
            {
                Id       = 2,
                Date     = new DateTime(2018, 10, 1),
                FlightId = 2,
                PlaneId  = 2,
                CrewId   = 2
            };

            var departureDTOToCreate = new DepartureDTO()
            {
                Date     = new DateTime(2018, 10, 1),
                FlightId = 2,
                PlaneId  = 2,
                CrewId   = 2
            };

            var departureRepositoryFake = A.Fake <IDepartureRepository>();

            A.CallTo(() => departureRepositoryFake.Create(A <Departure> ._)).Returns(departureMock);

            var unitOfWorkFake = A.Fake <IUnitOfWork>();

            A.CallTo(() => unitOfWorkFake.Set <Departure>()).Returns(departureRepositoryFake);

            var departureService = new DepartureService(unitOfWorkFake, AlwaysInValidValidator);

            // Act + Assert
            var exception = Assert.Throws <BadRequestException>(() => departureService.Create(departureDTOToCreate), "");

            Assert.AreEqual(exception.Message, "Is Invalid");
        }
Ejemplo n.º 27
0
 private Departure CreateProcessedDeparture(Departure tempDeparture, DateTime departureDateTime)
 {
     return(new Departure()
     {
         DepartureTime = new TimeOfDay()
         {
             Hours = departureDateTime.Hour, Minutes = departureDateTime.Minute, Seconds = departureDateTime.Second
         },
         DepartureDateTime = departureDateTime,
         StopId = tempDeparture.StopId,
         TripId = tempDeparture.TripId,
         ServiceId = tempDeparture.ServiceId,
         TripHeadsign = tempDeparture.TripHeadsign,
         TripShortName = tempDeparture.TripShortName,
         AgencyId = tempDeparture.AgencyId,
         RouteShortName = tempDeparture.RouteShortName,
         RouteLongName = tempDeparture.RouteLongName,
         Monday = tempDeparture.Monday,
         Tuesday = tempDeparture.Tuesday,
         Wednesday = tempDeparture.Wednesday,
         Thursday = tempDeparture.Thursday,
         Friday = tempDeparture.Friday,
         Saturday = tempDeparture.Saturday,
         Sunday = tempDeparture.Sunday,
         StartDate = tempDeparture.StartDate,
         EndDate = tempDeparture.EndDate
     });
 }
Ejemplo n.º 28
0
        public ActionResult DeleteAll(int id)
        {
            Departure.DeleteAll();
            List <Departure> allItems = Departure.GetAll();

            return(View("departures", allItems));
        }
Ejemplo n.º 29
0
        public StopConnection Create(
            RouteStop routeStop,
            Departure departure,
            StopVertex currentVertex,
            RouteStop nextRouteStop,
            StopVertex nextVertex,
            DateTime connectionStartDay,
            bool betweenTwoDays)
        {
            var endDay = connectionStartDay;

            if (betweenTwoDays)
            {
                endDay = endDay.AddDays(1);
            }
            return(new StopConnection()
            {
                Line = routeStop.Line,
                StartDateTime = connectionStartDay + departure.DepartureTime,
                SourceStop = currentVertex,
                EndDateTime = endDay + nextRouteStop
                              .Departures
                              .Where(p => p.RunIndex == departure.RunIndex)
                              .First()
                              .DepartureTime,
                DestinationStop = nextVertex,
            });
        }
Ejemplo n.º 30
0
        public HttpResponseMessage  UpdateFlightInfo(Departure value)
        {
            var model1 = new FlightInfoModel();

            model1.Departures.ToList().ForEach(x => x.Action = null);
            model1.SaveChanges();



            var model    = new FlightInfoModel();
            var toUpdate = model.Departures.First(x => x.Id == value.Id);

            toUpdate.Time        = value.Time.TrimEnd();
            toUpdate.Destination = value.Destination.TrimEnd();
            toUpdate.FlightNo    = value.FlightNo.TrimEnd();
            toUpdate.Gate        = value.Gate.TrimEnd();
            toUpdate.Remarks     = value.Remarks.TrimEnd();
            toUpdate.Action      = "u";

            model.Entry(toUpdate).State = EntityState.Modified;

            model.SaveChanges();



            return(Request.CreateResponse(HttpStatusCode.Accepted, new DepartureViewModel(value)));
        }
        public DepartureEditorForm(Departure departure) {
            InitializeComponent();
            initialDeparture = departure;
            buttonAdd.Text = "Save Departure";
            this.Text = "Edit";

            textBoxFlight.Text = departure.Flight;
            textBoxDestination.Text = departure.Destination;
            dateTimePicker.Value = departure.Time;
            textBoxStatus.Text = departure.Status;
            numericUpDownGate.Value = departure.Gate;
        }
Ejemplo n.º 32
0
        /// <summary>
        /// Handle the departures request response
        /// </summary>
        /// <param name="asyncResult"></param>
        private void HandleDeparturesResponse(IAsyncResult asyncResult)  ///now this is background
        {
            // get the state information
            QueryUpdateState queryUpdateState = (QueryUpdateState)asyncResult.AsyncState;
            HttpWebRequest getStationsRequest = (HttpWebRequest)queryUpdateState.AsyncRequest;

            // end the async request
            queryUpdateState.AsyncResponse = (HttpWebResponse)getStationsRequest.EndGetResponse(asyncResult);

            Stream streamResult;

            try
            {
                // get the stream containing the response from the async call
                streamResult = queryUpdateState.AsyncResponse.GetResponseStream();

                // load the XML
                XElement xmlDeparturesResponse = XElement.Load(streamResult);
                ObservableCollection<Departure> departureList = new ObservableCollection<Departure>();

                XElement originElem = xmlDeparturesResponse.Descendants("itdDepartureList").FirstOrDefault();
                if (originElem == null) return;
                
                DateTime? predictedTime = new DateTime?();

                int count = 0;
                foreach (var xmlStation in originElem.Descendants("itdDeparture"))
                {
                    if (xmlStation.HasAttributes && count < 8)
                    {
                        // get departure time
                        XElement plannedTimeElement = xmlStation.Descendants("itdDateTime").FirstOrDefault();
                        XElement itdRTDateTimeElement = xmlStation.Descendants("itdRTDateTime").FirstOrDefault();

                        DateTime plannedTime = ProcessItdDateTime(plannedTimeElement);

                        if (itdRTDateTimeElement != null)
                            predictedTime = ProcessItdDateTime(itdRTDateTimeElement);

                        // get serving line info
                        XElement itdServingLine = xmlStation.Descendants("itdServingLine").FirstOrDefault();

                        var departure = new Departure(plannedTime, itdServingLine.Attribute("number").Value, xmlStation.Attribute("stopName").Value, 0, itdServingLine.Attribute("direction").Value);

                        count++;
                    }
                }

                if (departureList.Count == 0)
                {
                    ResultTextBox.Dispatcher.BeginInvoke(
                      new System.Action(
                        delegate()
                        {
                            ResultTextBox.Text = ResultTextBox.Text + "\n\n" + "Keine Abfahrten.";
                        }
                    ));
                    return;
                }

                string stopId = xmlDeparturesResponse.Descendants("odvNameInput").FirstOrDefault().Value;
                //ItemViewModel station = NearbyItems.First(x => x.Location.Id.Equals(int.Parse(stopId)));

                foreach (Departure item in departureList)
                {
                    ResultTextBox.Dispatcher.BeginInvoke(
                      new System.Action(
                        delegate()
                        {
                            ResultTextBox.Text = ResultTextBox.Text + "\n" + item.Line + " -> " + item.Destination + " (Abfahrt: " + item.DepartureTime.ToString("HH:mm") + ")";
                        }
                    ));

                    System.Threading.Thread.Sleep(50);
                }
            }
            catch (FormatException fe)
            {
                throw new Exception("Fehler bei GetResponseStream()", fe.InnerException);
                // there was some kind of error processing the response from the web
                // additional error handling would normally be added here
            }
        }
Ejemplo n.º 33
0
    protected void getList(string station)
    {
        try
        {
            string startStation = station;

            // XML ophalen
            XDocument doc = null;
            Api irail = new Api();
            doc = irail.getApiData("liveboard/?station=" + startStation + "&fast=true", "NL", "xml");

            // List leegmaken (eventuele data van vorige request zit er nog in)
            departures.Clear();

            foreach (XElement d in doc.Descendants("departure"))
            {
                // Vertraging parsen naar datetimes
                string strDelay = d.Attribute("delay").Value;

                if (strDelay == "cancel")
                {
                    strDelay = "0";
                }

                double dblDelay = Convert.ToDouble(strDelay);
                DateTime dtDelay = new DateTime();

                // Jaar op 1900 zetten, anders klaagt sql bij insert (jaar mag niet 0 zijn)
                dtDelay = dtDelay.AddYears(1900);
                dtDelay = dtDelay.AddSeconds(dblDelay);

                // Tijd parsen naar datetime
                XElement timeNode = d.Element("time");
                string strTime = timeNode.Attribute("formatted").Value;

                DateTime time = DateTime.Parse(strTime);
                // ToUniversalTime (anders wordt er 1u bijgeteld, zomer-winteruur?)
                time = time.ToUniversalTime();

                // Andere data opvangen
                string destinationStation = d.Element("station").Value;
                string platform = d.Element("platform").Value;
                string vehicle = d.Element("vehicle").Value;

                // Nieuw object maken met data
                Departure departure = new Departure(startStation, destinationStation, platform, vehicle, time, dtDelay);

                // Toevoegen aan list
                departures.Add(departure);
            }

            // Data tegen repeater smijten
            rptDepartures.DataSource = departures;
            rptDepartures.DataBind();
            overviewPanel.Visible = true;
        }
        catch (Exception ex)
        {
            feedback.Attributes["class"] = "alert-message block-message";
            lblFeedback.Text = "Er is een fout opgetreden bij het laden van het overzicht.";
        }
    }
Ejemplo n.º 34
0
        private QueryDeparturesResult QueryDepartures(string uri, string xml)
        {
            XElement itdRequestElement = XDocument.Parse(xml).Element("itdRequest");
            if (itdRequestElement == null)
                throw new Exception("cannot find <itdRequest />");

            XElement itdDepartureMonitorRequestElement = itdRequestElement.Element("itdDepartureMonitorRequest");
            if (itdDepartureMonitorRequestElement == null)
                throw new Exception("cannot find <itdDepartureMonitorRequest />");

            XElement itdOdvElement = itdDepartureMonitorRequestElement.Element("itdOdv");
            if (itdOdvElement == null)
                throw new Exception("cannot find <itdOdv />");

            if (!"dm".Equals(this.GetAttributeValue(itdOdvElement, "usage", "cannot find attribute usage of itdOdv")))
                throw new Exception("cannot find <itdOdv usage=\"dm\" />");

            string defaultPlace = this.ProcessItdOdvPlace(itdOdvElement);

            XElement itdOdvNameElement = itdOdvElement.Element("itdOdvName");
            if (itdOdvNameElement == null)
                throw new Exception("cannot find <itdOdvName />");

            string itdOdvNameState = this.GetAttributeValue(itdOdvNameElement, "state", "cannot find attribute state of itdOdvName");
            if ("identified".Equals(itdOdvNameState))
            {
                QueryDeparturesResult departuresResult = new QueryDeparturesResult();
                Location location = this.ProcessOdvNameElem(itdOdvNameElement.Element("odvNameElem"), defaultPlace);

                // add departure
                departuresResult.StationDepartures.Add(new StationDepartures(location, new List<Departure>(), new List<LineDestination>()));

                XElement itdOdvAssignedStopsElement = itdOdvElement.Element("itdOdvAssignedStops");
                if (itdOdvAssignedStopsElement != null)
                {
                    foreach (XElement element in itdOdvAssignedStopsElement.Elements("itdOdvAssignedStop"))
                    {
                        Location assignedLocation = this.ProcessItdOdvAssignedStop(element);
                        if (this.FindStationDepartures(departuresResult.StationDepartures, assignedLocation.Id) == null)
                            departuresResult.StationDepartures.Add(new StationDepartures(assignedLocation, new List<Departure>(), new List<LineDestination>()));
                    }
                }

                DateTime? predictedTime = new DateTime?();
                XElement servingLinesElement = itdDepartureMonitorRequestElement.Element("itdServingLines");

                if (servingLinesElement != null)
                {
                    foreach (XElement itdServingLineElement in servingLinesElement.Elements("itdServingLine"))
                    {
                        string assignedStopIDAttr = this.GetAttributeValueOrNull(itdServingLineElement, "assignedStopID");
                        int assignedStopID = assignedStopIDAttr != null ? int.Parse(assignedStopIDAttr) : 0;

                        string destination = this.NormalizeLocationName(this.GetAttributeValueOrNull(itdServingLineElement, "direction"));

                        string destIDAttr = this.GetAttributeValueOrNull(itdServingLineElement, "destID");
                        int destinationId = destIDAttr == null || destIDAttr.Length <= 0 ? 0 : int.Parse(destIDAttr);

                        LineDestination lineDestination = new LineDestination(this.ProcessItdServingLine(itdServingLineElement), destinationId, destination);

                        StationDepartures stationDepartures = assignedStopID != 0 ? this.FindStationDepartures(departuresResult.StationDepartures, assignedStopID) : departuresResult.StationDepartures[0];

                        if (stationDepartures == null)
                            stationDepartures = new StationDepartures(new Location(LocationType.STATION, assignedStopID), new List<Departure>(), new List<LineDestination>());

                        if (!stationDepartures.Lines.Contains(lineDestination))
                            stationDepartures.Lines.Add(lineDestination);
                    }
                }

                XElement departureListElement = itdDepartureMonitorRequestElement.Element("itdDepartureList");
                if (departureListElement != null)
                {
                    foreach (XElement itdDepartureElement in departureListElement.Elements("itdDeparture"))
                    {
                        int id = int.Parse(this.GetAttributeValue(itdDepartureElement, "stopID", "cannot find attribute stopID of itdDeparture"));

                        StationDepartures stationDepartures = this.FindStationDepartures(departuresResult.StationDepartures, id);
                        if (stationDepartures == null)
                        {
                            string mapNameAttr = this.GetAttributeValueOrNull(itdDepartureElement, "mapName");
                            if (mapNameAttr == null || !"WGS84".Equals(mapNameAttr))
                                throw new Exception("unknown mapName: " + mapNameAttr);

                            int lon = int.Parse(this.GetAttributeValue(itdDepartureElement, "x", "cannot find attribute x of itdDeparture"));
                            int lat = int.Parse(this.GetAttributeValue(itdDepartureElement, "y", "cannot find attribute y of itdDeparture"));

                            stationDepartures = new StationDepartures(new Location(LocationType.STATION, id, lat, lon), new List<Departure>(), new List<LineDestination>());
                        }

                        string position = AbstractEfaProvider.NormalizePlatform(this.GetAttributeValueOrNull(itdDepartureElement, "platform"), this.GetAttributeValueOrNull(itdDepartureElement, "platformName"));
                        int countdown = int.Parse(this.GetAttributeValue(itdDepartureElement, "countdown", "cannot find attribute countdown of itdDeparture"));

                        XElement itdDateTime1 = itdDepartureElement.Element("itdDateTime");
                        if (itdDateTime1 == null)
                            throw new Exception("cannot find <itdDateTime />");

                        DateTime? plannedTime = new DateTime?(this.ProcessItdDateTime(itdDateTime1));

                        XElement itdRTDateTime = itdDepartureElement.Element("itdRTDateTime");
                        if (itdRTDateTime != null)
                            predictedTime = new DateTime?(this.ProcessItdDateTime(itdRTDateTime));

                        XElement itdServingLineElement = ((XContainer)itdDepartureElement).Element("itdServingLine");
                        if (itdServingLineElement == null)
                            throw new Exception("cannot find <itdServingLine />");

                        bool flag = "1".Equals(this.GetAttributeValueOrNull(itdServingLineElement, "realtime"));
                        string destination = this.NormalizeLocationName(this.GetAttributeValue(itdServingLineElement, "direction", "cannot find attribute direction of itdServingLine"));
                        int destinationId = int.Parse(this.GetAttributeValue(itdServingLineElement, "destID", "cannot find attribute destID of itdServingLine"));
                        string line = this.ProcessItdServingLine(itdServingLineElement);

                        if (flag && !predictedTime.HasValue)
                            predictedTime = plannedTime;

                        Departure departure = new Departure(plannedTime, predictedTime, countdown, line, (string)null, position, destinationId, destination, (string)null);
                        stationDepartures.Departures.Add(departure);
                    }
                }
                return departuresResult;
            }
            else if ("notidentified".Equals(itdOdvNameState))
                return new QueryDeparturesResult(QueryDeparturesResult.DepartureResultStatuses.INVALID_STATION);
            else
                throw new Exception("unknown nameState '" + itdOdvNameState + "' on " + uri);
        }