Exemplo n.º 1
0
        private void AddPassenger()
        {
            PassengersInFlightModel NewPassenger = PassengersViewModel.AddNewPassenger(SelectedFlight, " ");

            if (NewPassenger != null)
            {
                if (SelectedFlight.DepOrArrFlag.Equals("departure"))
                {
                    int n = Departures.IndexOf(SelectedFlight);
                    Departures[n].PassengersList.Add(NewPassenger);
                    ShowFlightDetails("departure");
                }
                else
                {
                    int n = Arrivals.IndexOf(SelectedFlight);
                    Arrivals[n].PassengersList.Add(NewPassenger);
                    ShowFlightDetails("arrival");
                }
            }
        }
Exemplo n.º 2
0
        private void EditPassengerData()
        {
            PassengersInFlightModel newData = PassengersViewModel.EditPassengerData(SelectedPassenger, SelectedFlight, "");

            if (newData != null)
            {
                newData.Id   = SelectedPassenger.Id;
                newData.Date = SelectedPassenger.Date;
                if (SelectedFlight.DepOrArrFlag.Equals("departure"))
                {
                    int n = Departures.IndexOf(SelectedFlight);
                    int m = Departures[n].PassengersList.IndexOf(SelectedPassenger);
                    Departures[n].PassengersList.RemoveAt(m);
                    Departures[n].PassengersList.Insert(m, newData);
                }
                else
                {
                    int n = Arrivals.IndexOf(SelectedFlight);
                    int m = Arrivals[n].PassengersList.IndexOf(SelectedPassenger);
                    Arrivals[n].PassengersList.RemoveAt(m);
                    Arrivals[n].PassengersList.Insert(m, newData);
                }
            }
        }