Exemple #1
0
 private void AbrirToolStripButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (Dialogo.ShowDialog() == DialogResult.OK)
         {
             MessageBox.Show("aqui estoy");
         }
         var archivo = new StreamReader(Dialogo.FileName);
         textBox1.Text = archivo.ReadToEnd();
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message.ToString());
         throw;
     }
 }
        protected void ExportaPDF(ETipoPagina pagina, CompanyInfo empresa)
        {
            ISchemaInfo schema = AppContext.ActiveSchema;

            try
            {
                schema = empresa as ISchemaInfo;
                if (schema == null)
                {
                    schema = AppContext.ActiveSchema;
                }
            }
            catch
            {
            }
            ExamenReportMng reportMng = new ExamenReportMng(schema);
            string          ruta      = string.Empty;

            switch (pagina)
            {
            case ETipoPagina.Portada:

                PortadaExamenRpt portada = reportMng.GetPortadaReport(Entity,
                                                                      empresa);
                Dialogo.FileName = "portada.pdf";
                Dialogo.ShowDialog();
                ruta = Dialogo.FileName;
                portada.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, ruta);

                break;

            case ETipoPagina.Preguntas:

                ExamenTestRpt examen = reportMng.GetDetailTestReport(Entity,
                                                                     empresa,
                                                                     _preguntas);

                Dialogo.FileName = "examen.pdf";
                Dialogo.ShowDialog();
                ruta = Dialogo.FileName;
                examen.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, ruta);

                break;
            }
        }
        protected void ExportaPDF(ETipoPagina pagina, CompanyInfo empresa)
        {
            ISchemaInfo schema = AppContext.ActiveSchema;

            try
            {
                schema = empresa as ISchemaInfo;
                if (schema == null)
                {
                    schema = AppContext.ActiveSchema;
                }
            }
            catch
            {
            }
            ExamenReportMng reportMng = new ExamenReportMng(schema);
            string          ruta      = string.Empty;

            switch (pagina)
            {
            case ETipoPagina.Portada:

                PortadaExamenRpt portada = reportMng.GetPortadaReport(Entity, empresa);
                Dialogo.FileName = "portada.pdf";
                Dialogo.ShowDialog();
                ruta = Dialogo.FileName;
                portada.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, ruta);

                break;

            case ETipoPagina.Preguntas:

                ExamenTestRpt examen = reportMng.GetDetailTestReport(Entity, empresa, _preguntas);

                Dialogo.FileName = "examen.pdf";
                Dialogo.ShowDialog();
                ruta = Dialogo.FileName;
                examen.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, ruta);

                break;

            case ETipoPagina.Respuestas:

                PlantillaRespuestasExamenRpt plantilla = reportMng.GetPlantillaRespuestasReport(Entity, empresa);

                Dialogo.FileName = "plantilla.pdf";
                Dialogo.ShowDialog();
                ruta = Dialogo.FileName;
                plantilla.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, ruta);

                break;

            case ETipoPagina.PlantillaCorrectora:

                PlantillaCorrectoraExamenRpt respuestas = reportMng.GetPlantillaCorrectoraReport(Entity,
                                                                                                 empresa);

                Dialogo.FileName = "respuestas.pdf";
                Dialogo.ShowDialog();
                ruta = Dialogo.FileName;
                respuestas.SetParameterValue("Empresa", empresa.Name);
                if (empresa.Oid == 2)
                {
                    ((CrystalDecisions.CrystalReports.Engine.TextObject)(respuestas.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                }
                respuestas.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, ruta);

                break;
            }
        }