Exemple #1
0
        /// <summary>
        /// Sets the flights.
        /// </summary>
        /// <param name="flights">The flights.</param>
        public void SetFlights(InterJetFlights flights)
        {
            int flightCounter = 0;
            var controlStack  = new Stack <Control>();

            foreach (InterJetFlight flight in flights.GetAllFlights())
            {
                var flightConfirmation = new ucInterJetFlightConfirmationUserControl();
                flightConfirmation.SetFlight(flight);
                if (flightCounter == 0)
                {
                    int xDefaultCoordinate = 19;
                    int yDefaultCoordinate = 19;
                    flightConfirmation.Location = new Point(xDefaultCoordinate, yDefaultCoordinate);
                }
                else
                {
                    Control previousControl = controlStack.Pop();
                    int     yDisplacement   = 100;
                    flightConfirmation.Location = new Point(previousControl.Location.X, previousControl.Location.Y + yDisplacement);
                }
                this.MainContainer.Controls.Add(flightConfirmation);
                controlStack.Push(flightConfirmation);
                flightCounter += 1;
            }
        }
        /// <summary>
        /// Sets the fare.
        /// </summary>
        /// <param name="flights">The flights.</param>
        private void SetFare(InterJetFlights flights)
        {
            var newFareContainer = new ucInterJetFareConfirmationContainerControl();

            newFareContainer.AutoSize = true;
            int yDisplacement = 90;

            newFareContainer.SetFlights(flights);
            var interJetFlightscontrol =
                this.MainContainer.Controls.OfType <ucInterJetFlightConfirmationContainerControl>().FirstOrDefault();
            var ucInterJetPassangerConfirmationContainerControl = this.MainContainer.Controls.OfType <ucInterJetPassangerConfirmationContainerControl>().FirstOrDefault();

            if (ucInterJetPassangerConfirmationContainerControl != null && interJetFlightscontrol != null)
            {
                int newSize = ucInterJetPassangerConfirmationContainerControl.Size.Height +
                              interJetFlightscontrol.Size.Height + yDisplacement;
                newFareContainer.Location = new Point(interJetFlightscontrol.Location.X, newSize);
            }
            this.MainContainer.Controls.Add(newFareContainer);
            this.ResizeButtonPanel();
        }
        public void SetFlights(InterJetFlights flights)
        {
            int flightCounter = 0;
            Stack <ucInterJetFareConfirmationUserControl> controlStack = new Stack <ucInterJetFareConfirmationUserControl>();

            ListTaxesInterjet.Fligth = 0;

            foreach (InterJetFlight flight in flights.GetAllFlights())
            {
                ListTaxesInterjet.Fligth = ListTaxesInterjet.Fligth + 1;
                if (ListTaxesInterjet.Fligth == 1)
                {
                    ListTaxesInterjet.turning      = 0;
                    ListTaxesInterjet.turningTaxes = 0;
                }
                else
                {
                    ListTaxesInterjet.turning      = ListTaxesInterjet.mit;
                    ListTaxesInterjet.turningTaxes = ListTaxesInterjet.mit;
                }

                ucInterJetFareConfirmationUserControl newFareConfirmation = new ucInterJetFareConfirmationUserControl();
                newFareConfirmation.SetFlight(flight);
                if (flightCounter == 0)
                {
                    int xDefaultCoordinate = 15;
                    int yDefaultCoordinate = 19;
                    newFareConfirmation.Location = new Point(xDefaultCoordinate, yDefaultCoordinate);
                }
                else
                {
                    ucInterJetFareConfirmationUserControl previous = controlStack.Pop();
                    int yDisplacement = 120;
                    newFareConfirmation.Location = new Point(previous.Location.X, previous.Location.Y + yDisplacement);
                }
                this.MainContainer.Controls.Add(newFareConfirmation);
                controlStack.Push(newFareConfirmation);
                flightCounter += 1;
            }
        }
        /// <summary>
        /// Sets the flights.
        /// </summary>
        /// <param name="flights">The flights.</param>
        private void SetFlights(InterJetFlights flights)
        {
            var flightContainerControl = new ucInterJetFlightConfirmationContainerControl();

            flightContainerControl.AutoSize = true;
            flightContainerControl.SetFlights(flights);

            int xDefaultCoordinate = 3;
            int yDisplacement      = 95;
            var passengerControl   = this.MainContainer.Controls.OfType <ucInterJetPassangerConfirmationContainerControl>();

            if (passengerControl.Any())
            {
                var passangerControl = passengerControl.FirstOrDefault();
                if (passangerControl != null)
                {
                    flightContainerControl.Location = new Point(xDefaultCoordinate,
                                                                passangerControl.Size.Height + yDisplacement);
                }
                this.MainContainer.Controls.Add(flightContainerControl);
                this.ControlStack.Push(flightContainerControl);
            }
        }
 public void SetFlights(InterJetFlights flights)
 {
     this.Handler.SetFlights(flights);
 }