Пример #1
0
        private void AdvSaleButton_Click(object sender, EventArgs e)
        {
            List <Vuelo> vuelosRuta  = new List <Vuelo>();
            bool         hayAsientos = true;

            if (listView2.Items.Count == 0)
            {
                MessageBox.Show("NO EXISTE RUTA", "ERROR",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                string ruta    = listView2.Items[0].SubItems[2].Text;
                string newruta = "";
                Vuelo  vc      = new Vuelo();
                // string vueloinf = "";

                for (int x = 0; x < ruta.Length; x = x + 3)
                {
                    newruta = newruta + ruta[x];
                }



                int indx = 0;

                while (indx < newruta.Length - 1)
                {
                    foreach (Vuelo v in listaVuelos)
                    {
                        if (v.getOrigen() == newruta[indx] && v.getDestino() == newruta[indx + 1])
                        {
                            if (v.getAsientosDisp() == 0)
                            {
                                hayAsientos = false; break;
                            }
                            vuelosRuta.Add(v);
                            //   vc = v;
                            //    vueloinf = v.ToString(' ');
                            //    SeleccionAsiento venta = new SeleccionAsiento(ref vc,ref vueloinf);
                            //   venta.ShowDialog();
                        }
                    } //fin foreach
                    indx++;
                }     //fin while


                if (hayAsientos)
                {
                    VentaAvanzada venta = new VentaAvanzada(ruta, ref vuelosRuta);
                    venta.ShowDialog();
                }
                else
                {
                    MessageBox.Show("UNO O MAS VUELOS NO TIENE ASIENTOS DISPONIBLES ", "ERROR",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Пример #2
0
        private void AdvSaleButton_Click(object sender, EventArgs e)
        {
            List<Vuelo> vuelosRuta = new List<Vuelo>();
            bool hayAsientos = true;

            if (listView2.Items.Count == 0)
            {
                MessageBox.Show("NO EXISTE RUTA", "ERROR",
            MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                string ruta = listView2.Items[0].SubItems[2].Text;
                string newruta = "";
                Vuelo vc = new Vuelo();
               // string vueloinf = "";

                for(int x = 0; x < ruta.Length;x=x+3)
                {
                    newruta = newruta+ruta[x];
                }

                int indx=0;

                while (indx < newruta.Length-1)
                {

                    foreach (Vuelo v in listaVuelos)
                    {

                        if (v.getOrigen() == newruta[indx] && v.getDestino() == newruta[indx + 1])
                        {

                            if (v.getAsientosDisp() == 0) { hayAsientos = false; break; }
                            vuelosRuta.Add(v);
                            //   vc = v;
                            //    vueloinf = v.ToString(' ');
                            //    SeleccionAsiento venta = new SeleccionAsiento(ref vc,ref vueloinf);
                            //   venta.ShowDialog();
                        }

                    }//fin foreach
                    indx++;
                }//fin while

                if (hayAsientos)
                {
                    VentaAvanzada venta = new VentaAvanzada(ruta, ref vuelosRuta);
                    venta.ShowDialog();
                }
                else
                {
                    MessageBox.Show("UNO O MAS VUELOS NO TIENE ASIENTOS DISPONIBLES ", "ERROR",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                }
            }
        }