示例#1
0
        public (VoRespuesta, byte[]) Reporte(int Id)
        {
            VoRespuesta voRespuesta = new VoRespuesta {
                Estatus = true
            };

            byte[] respuesta = null;
            try
            {
                ReportDocument rptCliente = new Reporte();
                var            ds         = _ICliente.Reporte(Id);
                ds.Tables[0].TableName = "dtCliente";
                ds.Tables[1].TableName = "dtContactos";
                rptCliente.SetDataSource(ds);
                Stream pdf = rptCliente.ExportToStream(ExportFormatType.PortableDocFormat);

                rptCliente.Close();

                using (BinaryReader br = new BinaryReader(pdf))
                {
                    respuesta = br.ReadBytes((int)pdf.Length);
                }
            }
            catch (Exception ex)
            {
                voRespuesta.Estatus = false;
                voRespuesta.Mensaje = ex.Message;
                return(voRespuesta, respuesta);
            }

            return(voRespuesta, respuesta);
        }