Пример #1
0
        private void clic_reporte(object sender, SelectionChangedEventArgs e)
        {
            reporteSeleccionado = (Reporte)dg_reportes.SelectedItem;


            if (reporteSeleccionado != null)
            {
                wp_imagenes.Children.Clear();
                dp_fecha.SelectedDate = reporteSeleccionado.Fecha;
                tb_Descripcion.Text   = reporteSeleccionado.Descripcion;
                tb_direccion.Text     = reporteSeleccionado.Direccion;

                conductoresSeleccionados = new List <Conductor>();
                List <ConductoresReporte> conductoresDelReporte = ConductoresReporteDAO.getAllConductoresReportesByIdReporte(reporteSeleccionado.IdReporte);
                Conductor conductor;
                foreach (ConductoresReporte conductoresReporte in conductoresDelReporte)
                {
                    conductor = ConductorDAO.getConductoraById(conductoresReporte.IdConductor);
                    conductoresSeleccionados.Add(conductor);
                }

                vehiculosSeleccionados = new List <Vehiculo>();
                List <VehiculosReporte> vehiculosDelReporte = VehiculosReporteDAO.getAllVehiculosReporteByIdReporte(reporteSeleccionado.IdReporte);
                Vehiculo vehiculo;
                foreach (VehiculosReporte vehiculosReporte in vehiculosDelReporte)
                {
                    vehiculo = VehiculoDAO.getVehiculoById(vehiculosReporte.IdVehiculo);
                    vehiculosSeleccionados.Add(vehiculo);
                }

                String        actualPath = actualPath = System.IO.Path.GetTempPath();
                String        folderName = String.Format("/Reporte{0}", reporteSeleccionado.IdReporte);
                String        newPath    = actualPath + folderName;
                DirectoryInfo directory  = Directory.CreateDirectory(newPath);


                ConexionSFTP.bajarArchivo(newPath, folderName);

                FileInfo[] fileInfos = directory.GetFiles();

                Image fotografia = new Image();
                foreach (FileInfo fileInfo in fileInfos)
                {
                    if (fileInfo.FullName != null)
                    {
                        Uri uri = new Uri(fileInfo.FullName);
                        fotografia        = new Image();
                        fotografia.Source = new BitmapImage(uri);
                        fotografia.Width  = 100;
                        fotografia.Height = 100;
                        wp_imagenes.Children.Add(fotografia);
                        fotografias.Add(fotografia);
                    }
                }
                actualizarTablaConductoresSeleccionados();
                actualizarTablaVehiculosSeleccionados();
            }
        }