Ejemplo n.º 1
0
 private void DeletePassenger()
 {
     if (SelectedPassenger != null)
     {
         PassengersViewModel.DeletePassenger(SelectedPassenger, SelectedFlight);
         if (SelectedFlight.DepOrArrFlag.Equals("departure"))
         {
             int n = Departures.IndexOf(SelectedFlight);
             Departures[n].PassengersList.Remove(SelectedPassenger);
             ShowFlightDetails("departure");
         }
         else
         {
             int n = Arrivals.IndexOf(SelectedFlight);
             Arrivals[n].PassengersList.Remove(SelectedPassenger);
             ShowFlightDetails("arrival");
         }
     }
 }
Ejemplo n.º 2
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");
                }
            }
        }
Ejemplo n.º 3
0
        private void EditFlight()
        {
            TripModel changedFlight = FlightsViewModel.EditFlight(SelectedFlight);

            if (changedFlight != null)
            {
                if (changedFlight.DepOrArrFlag.Equals("departure"))
                {
                    int n = Departures.IndexOf(SelectedFlight);
                    Departures.Remove(SelectedDepFlight);
                    Departures.Insert(n, changedFlight);
                    SelectedFlight = Departures[n];
                }
                else
                {
                    int n = Arrivals.IndexOf(SelectedFlight);
                    Arrivals[n]    = new TripModel(changedFlight);
                    SelectedFlight = Arrivals[n];
                }
            }
        }
Ejemplo n.º 4
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);
                }
            }
        }