Exemple #1
0
 private void CargarCyVInvolucrados(int idReporte)
 {
     vehiculosYConductoresInvolucrados = ReporteConductorVehiculoDAO.obtenerConductoresVehiculosReporte(idReporte);
     Console.WriteLine("Regreso al llenado de la tabla");
     dg_listaInvolucrados.AutoGenerateColumns = false;
     dg_listaInvolucrados.ItemsSource         = vehiculosYConductoresInvolucrados;
 }
Exemple #2
0
        private void btn_registrar_reporte_Click(object sender, RoutedEventArgs e)
        {
            String direccion = txt_direccion.Text;
            String fecha     = txt_fecha.Text;
            String estatus   = "Pendiente";

            Boolean camposLlenos = true;

            if (direccion.Length == 0)
            {
                camposLlenos = false;
                txt_direccion.BorderBrush = Brushes.Red;
            }
            if (fecha.Length == 0)
            {
                camposLlenos          = false;
                txt_fecha.BorderBrush = Brushes.Red;
            }
            if (img_num1.Source == null)
            {
                camposLlenos = false;
            }
            if (img_num2.Source == null)
            {
                camposLlenos = false;
            }
            if (img_num3.Source == null)
            {
                camposLlenos = false;
            }

            if (camposLlenos)
            {
                int idDelegacion = MainWindow.idDelegacionLoggeada;

                byte[] imagen1;
                byte[] imagen2;
                byte[] imagen3;
                byte[] imagen4;
                byte[] imagen5;
                byte[] imagen6;
                byte[] imagen7;
                byte[] imagen8;

                imagen1 = System.IO.File.ReadAllBytes(fileUri1.LocalPath);
                imagen2 = System.IO.File.ReadAllBytes(fileUri2.LocalPath);
                imagen3 = System.IO.File.ReadAllBytes(fileUri3.LocalPath);

                if (img_num4.Source == null)
                {
                    imagen4 = new byte [0];
                }
                else
                {
                    imagen4 = System.IO.File.ReadAllBytes(fileUri4.LocalPath);
                }

                if (img_num5.Source == null)
                {
                    imagen5 = new byte[0];
                }
                else
                {
                    imagen5 = System.IO.File.ReadAllBytes(fileUri5.LocalPath);
                }

                if (img_num6.Source == null)
                {
                    imagen6 = new byte[0];
                }
                else
                {
                    imagen6 = System.IO.File.ReadAllBytes(fileUri6.LocalPath);
                }

                if (img_num7.Source == null)
                {
                    imagen7 = new byte[0];
                }
                else
                {
                    imagen7 = System.IO.File.ReadAllBytes(fileUri7.LocalPath);
                }

                if (img_num8.Source == null)
                {
                    imagen8 = new byte[0];
                }
                else
                {
                    imagen8 = System.IO.File.ReadAllBytes(fileUri8.LocalPath);
                }


                int resultado = ReporteDAO.agregarReporte(idDelegacion, fecha, estatus, direccion, imagen1, imagen2, imagen3, imagen4, imagen5, imagen6, imagen7, imagen8);

                int resultado2 = 0;
                int reporteMax = ReporteDAO.obtenerIdReporteMax();

                Console.WriteLine("El reporte max es: " + reporteMax);

                foreach (Vehiculo vehiculoAReporte in vehiculosReporte)
                {
                    Vehiculo vehiculoAux = new Vehiculo(vehiculoAReporte.NumeroLicencia, vehiculoAReporte.IdVehiculo);

                    resultado2 = ReporteConductorVehiculoDAO.agregarReporteConductorVehiculo(reporteMax, vehiculoAux);
                }

                if (resultado > 0 && resultado2 > 0)
                {
                    MessageBox.Show("El Reporte se registro exitosamente", "Registro exitoso");
                }
                else
                {
                    MessageBox.Show("No fue posible hacer el registro", "Ocurrió un error");
                }

                salir();
            }
            else
            {
                MessageBox.Show("Favor de llenar todos los campos e ingresar mínimo 3 fotografías", "Campos vacíos");
            }
        }
 private void CargarCyVInvolucrados(int idReporte)
 {
     vehiculosYConductoresInvolucrados        = ReporteConductorVehiculoDAO.obtenerConductoresVehiculosReporte(idReporte);
     dg_listaInvolucrados.AutoGenerateColumns = false;
     dg_listaInvolucrados.ItemsSource         = vehiculosYConductoresInvolucrados;
 }