Пример #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            List <string> errores = ValidarAeronave();

            string erroresAMostrar = "Se encontraron los siguientes errores en la aeronave a moodificar:" + System.Environment.NewLine;

            foreach (var item in errores)
            {
                erroresAMostrar = string.Concat(erroresAMostrar + System.Environment.NewLine, item);
            }

            if (errores.Count > 0)
            {
                MessageBox.Show(erroresAMostrar, "Error.");
                return;
            }
            string   matricula       = MatriculaNaveRegistrar.Text;
            int      horas           = int.Parse(HorasVueloNaveRegistrar.Text);
            string   tipo            = TipoNaveRegistrar.Text;
            DateTime fecha           = (DateTime)FechaAeronavegabilidad.SelectedDate;
            DateTime fechaInspeccion = (DateTime)FechaInspección.SelectedDate;
            DateTime ano             = (DateTime)AnoFabricacion.SelectedDate;

            string estado = Estado.Text;

            Aeronave a = new Aeronave(matricula, tipo, horas, fechaInspeccion, fecha, ano, estado);

            if (a.ActualizarEnBD() > 0)
            {
                MessageBox.Show("La nave se ha actualizado correctamente.");
                Close();
            }
        }