Exemplo n.º 1
0
 private void OverViewPassengersRefresh(System.Windows.Controls.DataGrid dg)
 {
     ServiceReference1.PlaneDto       plane = (ServiceReference1.PlaneDto)dg.SelectedItem;
     ServiceReference1.PassengerDto[] passengers;
     if (plane == null)
     {
         passengers = new ServiceReference1.PassengerDto[0];
     }
     else
     {
         passengers = proxyPassenger.GetPassengersWherePlaneId(plane.PlaneId);
     }
     dgOverViewPassengers.ItemsSource = passengers;
 }
Exemplo n.º 2
0
        private void BuyPlane_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ServiceReference1.PlaneDto NewPlane = new ServiceReference1.PlaneDto();

                ServiceReference1.PlaneDto[]      planes = proxyPlane.GetPlanes();
                List <ServiceReference1.PlaneDto> pla    = new List <ServiceReference1.PlaneDto>(planes);
                int max = pla.Max(x => x.PlaneId);
                NewPlane.PlaneId      = max + 1;
                NewPlane.SerialNumber = Int32.Parse(BuyPlaneSerialNumber.Text);
                NewPlane.AirportId    = Int32.Parse(BuyPlaneAirportId.Text);
                proxyPlane.AddPlane(NewPlane);

                planes = proxyPlane.GetPlanes();
                dgPlanes.ItemsSource = planes;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Add proper params", "PARAMS !!", MessageBoxButton.OK);
                return;
            }
        }
Exemplo n.º 3
0
        public void MyInit()
        {
            ServiceReference1.AirportDto airport = new ServiceReference1.AirportDto();
            airport.AirportId = 1;
            airport.City      = "Danzig";
            proxyAirports.AddAirport(airport);
            airport.AirportId = 2;
            airport.City      = "Moscow";
            proxyAirports.AddAirport(airport);
            airport.AirportId = 3;
            airport.City      = "Breslau";
            proxyAirports.AddAirport(airport);

            ServiceReference1.PlaneDto plane = new ServiceReference1.PlaneDto();
            plane.PlaneId      = 1;
            plane.SerialNumber = 12311;
            plane.AirportId    = 1;
            proxyPlane.AddPlane(plane);
            plane              = new ServiceReference1.PlaneDto();
            plane.PlaneId      = 2;
            plane.SerialNumber = 123111;
            plane.AirportId    = 2;
            proxyPlane.AddPlane(plane);

            ServiceReference1.PassengerDto pass = new ServiceReference1.PassengerDto();
            pass.PassengerId = 1;
            pass.FirstName   = "Adam";
            pass.LastName    = "Smith";
            pass.PlaneId     = null;
            proxyPassenger.AddPassenger(pass);
            pass             = new ServiceReference1.PassengerDto();
            pass.PassengerId = 2;
            pass.FirstName   = "John";
            pass.LastName    = "Wayne";
            pass.PlaneId     = null;
            proxyPassenger.AddPassenger(pass);

            ServiceReference1.FlightDto flight = new ServiceReference1.FlightDto();
            flight.FlightId       = 1;
            flight.TimeDeparture  = new System.DateTime(2019, 11, 2, 13, 13, 13);
            flight.TimeArrival    = new System.DateTime(2019, 11, 3, 16, 16, 16);
            flight.AimArrivalId   = 2;
            flight.AimDepartureId = 1;
            flight.PlaneId        = 1;
            proxyFlight.AddFlight(flight);
            flight.FlightId       = 2;
            flight.TimeDeparture  = new System.DateTime(2019, 11, 5, 13, 13, 13);
            flight.TimeArrival    = new System.DateTime(2019, 11, 8, 16, 16, 16);
            flight.AimArrivalId   = 3;
            flight.AimDepartureId = 2;
            flight.PlaneId        = 2;
            proxyFlight.AddFlight(flight);
            flight.FlightId       = 3;
            flight.TimeDeparture  = new System.DateTime(2019, 11, 7, 13, 13, 13);
            flight.TimeArrival    = new System.DateTime(2019, 11, 16, 16, 16, 16);
            flight.AimArrivalId   = 3;
            flight.AimDepartureId = 2;
            flight.PlaneId        = 1;
            proxyFlight.AddFlight(flight);

            ServiceReference1.TicketDto ticket = new ServiceReference1.TicketDto();
            ticket.TicketId    = 1;
            ticket.Price       = 100;
            ticket.FlightId    = 1;
            ticket.PassengerId = 1;
            proxyTicket.AddTicket(ticket);
            ticket.TicketId    = 2;
            ticket.Price       = 100;
            ticket.FlightId    = 2;
            ticket.PassengerId = 1;
            proxyTicket.AddTicket(ticket);
        }