コード例 #1
0
ファイル: GenerarReportes.xaml.cs プロジェクト: chaqui/SGREB
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DateTime inicio;
            DateTime final;
            string   ubicacion;

            System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();

            if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                ubicacion = folderBrowserDialog1.SelectedPath;
            }
            else
            {
                return;
            }

            try
            {
                inicio = DateTime.Parse(fechaInicial.SelectedDate.ToString());
                final  = DateTime.Parse(fechaFinal.SelectedDate.ToString());
            }
            catch
            {
                return;
            }

            Reportes      reportes      = new Reportes();
            PDFCreador    creator       = new PDFCreador();
            TipoIncidente tipoIncidente = new TipoIncidente();
            Bombero       bombero       = new Bombero();

            foreach (var comun in comunes)
            {
                List <DataGridComunDatos> datos = reportes.obtenerReproteComunes(comun, inicio, final);

                if (datos.Count > 0)
                {
                    creator.crearPDFcomun(tipoIncidente.obtenerNombre(comun), inicio, final, datos, bombero.seleccionarJefeDeCompania(), bombero.secretario(), ubicacion + "/" + tipoIncidente.obtenerNombre(comun));
                }
            }

            foreach (var incendio in incendios)
            {
                List <DataGridIncendiosDatos> datos = reportes.obtenerIncendios(incendio, inicio, final);
                if (datos.Count > 0)
                {
                    creator.crearPDFIncendio(tipoIncidente.obtenerNombre(incendio), inicio, final, datos, bombero.seleccionarJefeDeCompania(), bombero.secretario(), ubicacion + "/" + tipoIncidente.obtenerNombre(incendio));
                }
            }
        }
コード例 #2
0
ファイル: GenerarReporte1.xaml.cs プロジェクト: chaqui/SGREB
        private void crearPdfComun()
        {
            DateTime fechaInicio            = DateTime.Parse(dpInicio.SelectedDate.ToString());
            DateTime fechaFinal             = DateTime.Parse(dpFinal.SelectedDate.ToString());
            List <DataGridComunDatos> datos = new List <DataGridComunDatos>();

            foreach (var item in dgComun.Items)
            {
                datos.Add((DataGridComunDatos)item);
            }

            PDFCreador pdf = new PDFCreador();

            TipoIncidente tipo       = new TipoIncidente();
            var           nombreTipo = tipo.obtenerNombre(idIncidente);

            List <string> ubicaciion = obtenerLugar();

            if (ubicaciion[0] != "")
            {
                pdf.crearPDFcomun(nombreTipo, fechaInicio, fechaFinal, datos, new BomberoInforme {
                    NombreCompleto = "Juan Pedro Paz"
                }, new BomberoInforme {
                    NombreCompleto = "Pedro Antonio Yoc Perez"
                }, ubicaciion[0]);
            }
            else
            {
                MessageBox.Show("No coloco correctamente la ubicacion");
            }
        }