예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                int    numV  = booking.Count / 2;
                string vuelo = string.Empty;

                if (segments <= numV)
                {
                    vuelo = "Ida";
                }
                else
                {
                    vuelo = "Vuelta";
                }

                segments++;
                lblAlerta.Text = "";

                //listInterjetSeatsReturn = null;
                //listInterjetSeatsReturn = new List<interjetSeats>();

                for (int j = 0; j < dataGridView1.Rows.Count; j++)
                {
                    if (dataGridView1.Rows[j].Cells["Asiento"].Value.ToString() != "Sin Asignar.")
                    {
                        interjetSeats             = new interjetSeats();
                        interjetSeats.Id          = dataGridView1.Rows[j].Cells["ID"].Value.ToString();
                        interjetSeats.Name        = dataGridView1.Rows[j].Cells["Pasajero"].Value.ToString();
                        interjetSeats.Segment     = departureStation + " - " + arrivalStation;
                        interjetSeats.Seat        = dataGridView1.Rows[j].Cells["Asiento"].Value.ToString();
                        interjetSeats.IsSelect    = true;
                        interjetSeats.typeSegment = vuelo;
                        listInterjetSeatsReturn.Add(interjetSeats);
                    }
                    //else
                    //{
                    //    MessageBox.Show("Seleccione asiento para el pasajero ." + dataGridView1.Rows[j].Cells["Pasajero"].Value.ToString(), "MYCTS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //    return;
                    //}
                }

                if (segments != booking.Count)
                {
                    MessageBox.Show("Se asignaron correctamente los asientos para el segmento " + departureStation + " - " + arrivalStation + "\nContinuara con el siguiente segmento.", "MYCTS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    assignAsets();
                }
                else
                {
                    MessageBox.Show("Se asignaron correctamente los asientos para el segmento " + departureStation + " - " + arrivalStation, "MYCTS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
            catch (Exception err)
            {
                throw new Exception();
            }
        }
예제 #2
0
        public void assignAsets()
        {
            try
            {
                numP             = 1;
                numPas           = 0;
                airPlaneName     = booking[segments].SeatAvailabilityResponse.EquipmentInfos[0].Name;
                airPlane         = booking[segments].SeatAvailabilityResponse.EquipmentInfos[0].EquipmentType;
                arrivalStation   = booking[segments].SeatAvailabilityResponse.EquipmentInfos[0].ArrivalStation;
                departureStation = booking[segments].SeatAvailabilityResponse.EquipmentInfos[0].DepartureStation;

                lblAirPlane.Text = airPlaneName;
                List <MyCTS.Services.APIInterJet.SeatInfo> listSeats = booking[segments].SeatAvailabilityResponse.EquipmentInfos[0].Compartments[0].Seats;
                panel1.Controls.Clear();
                if (airPlane == "320")
                {
                    ucInterjetAirPlane1 panel = new ucInterjetAirPlane1();
                    panel1.Controls.Add(panel);
                }
                else
                {
                    ucInterjetAirPlane2 panel = new ucInterjetAirPlane2();
                    panel1.Controls.Add(panel);
                }
                onclick = true;
                for (int i = 0; i < listSeats.Count; i++)
                {
                    string seatAvailability = listSeats[i].SeatAvailability.ToString();
                    string seatDesignator   = listSeats[i].SeatDesignator;

                    if (!seatDesignator.Contains('$'))
                    {
                        findControl(seatDesignator, seatAvailability);
                    }
                }
                if (dispo == 0)
                {
                    segments++;
                    MessageBox.Show("No hay asientos disponibles para el segmento " + departureStation + "-" + arrivalStation + " ", "MyCTS");
                    assignAsets();
                }
                else
                {
                    onclick = false;
                    List <Entities.InterJetPassanger> pass = tickets.Passangers.GetAll();

                    listInterjetSeats.Clear();
                    for (int i = 0; i < pass.Count; i++)
                    {
                        if (!pass[i].ToString().Contains("Menor"))
                        {
                            interjetSeats      = new interjetSeats();
                            interjetSeats.Id   = pass[i].ID;
                            interjetSeats.Name = pass[i].FullName;
                            interjetSeats.Seat = "";
                            listInterjetSeats.Add(interjetSeats);
                            numPas++;
                        }
                    }
                    setGrid();
                }
            }
            catch (Exception err)
            {
            }
        }