public Ingresar_Vuelo_Pilotos(Ingrear_vuelo_avion w)
        {
            InitializeComponent();
            windowsVueloAvion = w;

            nePiloto = new NePiloto();
            ds       = new DataSet();
            ds       = nePiloto.getTipoPiloto();
            comboBoxTipoPiloto.DisplayMemberPath = "NOMBRE";
            comboBoxTipoPiloto.SelectedValuePath = "NOMBRE";
            comboBoxTipoPiloto.ItemsSource       = ds.Tables["piloto_tipo"].DefaultView;


            aeronave                   = new Aeronave();
            aeronave                   = Sesion.GetValue <Aeronave>("aeronave");
            labelNave.Content          = string.Format("{0} ({1})", aeronave.Marca, aeronave.TipoAeronave.NombreTipo);
            labelDistancia.Content     = Sesion.GetValue <double>("kmDistancia") + " Km";
            labelFechaPartida.Content  = string.Format("{0} ({1} Hrs)", Sesion.GetValue <DateTime>("fechaPartida").ToString("dd'/'MM'/'yyyy"), Sesion.GetValue <string>("showHoraPartida"));
            labelFechaLlegada.Content  = string.Format("{0} ({1} Hrs)", Sesion.GetValue <DateTime>("fechaLlegada").ToString("dd'/'MM'/'yyyy"), Sesion.GetValue <string>("showHoraLlegada"));
            labelOrigenDestino.Content = string.Format("{0}/{1}", Sesion.GetValue <string>("origen"), Sesion.GetValue <string>("destino"));
            labelTipoVuelo.Content     = Sesion.GetValue <string>("NombreCondicionVuelo");

            buttonFinalizar.IsEnabled   = false;
            buttonVerLicencia.IsEnabled = false;
            radioCopiloto.IsEnabled     = false;
            radioPiloto.IsEnabled       = false;

            piloto        = new Usuario();
            piloto.Rut    = textBoxRut.Text;
            piloto.Nombre = textBoxPiloto.Text;
            piloto.Licencia.TipoLicencia.NombreLicencia = comboBoxTipoPiloto.Text;
            ds = nePiloto.listarPiloto(piloto);
            dgListaPilotdos.ItemsSource = new DataView(ds.Tables["listaPiloto"]);
        }
Beispiel #2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DateTime fechaSelect = new DateTime();
                fechaSelect = dpFechaSalida.SelectedDate.Value;
                NeVuelo valFechaHora = new NeVuelo();
                int     resp;
                resp = valFechaHora.validarFechaHora(fechaSelect, hora);

                switch (resp)
                {
                case -1:
                    MessageBox.Show("Debe seleccionar un fecha futura");
                    break;

                case -2:
                    MessageBox.Show("Hora despegue debe tener 4 horas de anticipacion");
                    break;

                case 0:
                    if (radioButtonIrf.IsChecked == false & radioButtonVrf.IsChecked == false)
                    {
                        MessageBox.Show("Verifique que no existan datos vacios"); return;
                    }

                    else if (radioButtonIrf.IsChecked == true)
                    {
                        Sesion.SetValue("condicionVuelo", idCondicionVuelo);
                    }
                    else if (radioButtonVrf.IsChecked == true)
                    {
                        Sesion.SetValue("condicionVuelo", idCondicionVuelo);
                    }

                    ciudadOrigen           = new Ciudad();
                    ciudadDestino          = new Ciudad();
                    ciudadOrigen.IdCiudad  = Convert.ToInt32(comboBoxOrigen.SelectedValue.ToString());
                    ciudadDestino.IdCiudad = Convert.ToInt32(comboBoxDestino.SelectedValue.ToString());
                    string origen      = comboBoxOrigen.Text;
                    string destino     = comboBoxDestino.Text;
                    double kmDistancia = new double();
                    kmDistancia = neVueloGetCiudad.getDintancia(ciudadOrigen, ciudadDestino);
                    Sesion.SetValue("kmDistancia", kmDistancia);
                    Ingrear_vuelo_avion next = new Ingrear_vuelo_avion();
                    this.Hide();
                    next.ShowDialog();
                    break;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Verifique que no existan datos vacios");
            }
        }