Exemple #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crRoadMapCampania rpt = new crRoadMapCampania();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            using (new LoadingClass.PleaseWait(this.Location, "Generando..."))
            {
                DiskFileDestinationOptions objDiskOpt         = new DiskFileDestinationOptions();
                OperationResult            objOperationResult = new OperationResult();
                string ruta  = Common.Utils.GetApplicationConfigValue("rutaReportes").ToString();
                var    Lista = new AuthorizedPersonBL().GetAuthorizedPersonPagedAndFiltered(ref objOperationResult, 0, null, null, null);

                foreach (var item in Lista)
                {
                    var     Cabecera = new CalendarBL().HojaRutaCabecera(item.v_AuthorizedPersonId);
                    var     Detalle  = new CalendarBL().HojaRutaDetalle(item.v_ProtocolId);
                    var     rp       = new Reports.crRoadMapCampania();
                    DataSet ds       = new DataSet();

                    DataTable dtHeader = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Cabecera);
                    DataTable dtDetail = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Detalle);

                    dtHeader.TableName = "dtCabecera";
                    dtDetail.TableName = "dtDetalle";

                    ds.Tables.Add(dtHeader);
                    ds.Tables.Add(dtDetail);
                    rp.SetDataSource(ds);


                    rp.ExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    objDiskOpt = new DiskFileDestinationOptions();
                    objDiskOpt.DiskFileName = Application.StartupPath + @"\TempMerge\" + Guid.NewGuid().ToString() + ".pdf";
                    _filesNameToMerge.Add(objDiskOpt.DiskFileName);
                    rp.ExportOptions.DestinationOptions = objDiskOpt;
                    rp.Export();
                }

                var x = _filesNameToMerge.ToList();
                _mergeExPDF.FilesName = x;
                //_mergeExPDF.DestinationFile = Application.StartupPath + @"\TempMerge\" + _serviceId + ".pdf"; ;
                _mergeExPDF.DestinationFile = ruta + "xxx" + ".pdf";;
                _mergeExPDF.Execute();
                _mergeExPDF.RunFile();
            }
        }