コード例 #1
0
        public ActionResult ConsultaPersonas(string nombre)
        {
            DB_ChambaSearchEntities db = new DB_ChambaSearchEntities();
            var v = db.persona.Include("tipoCuenta").Where(x => x.nombres.Equals(nombre));

            return(View(v.ToList()));
        }
コード例 #2
0
        public ActionResult operacionReporte(string id)
        {
            LocalReport lr   = new LocalReport();
            string      path = Path.Combine(Server.MapPath("~/Reportes"), "Report1.rdlc");

            if (System.IO.File.Exists(path))
            {
                lr.ReportPath = path;
            }
            else
            {
                return(View("Index"));
            }
            List <persona>          cm = new List <persona>();
            DB_ChambaSearchEntities db = new DB_ChambaSearchEntities();

            cm = db.persona.ToList();

            ReportDataSource rd = new ReportDataSource("DataSet1", cm);

            lr.DataSources.Add(rd);

            string deviceInfo = @"<DeviceInfo>
                      <OutputFormat>EMF</OutputFormat>
                      <PageWidth>8.5in</PageWidth>
                      <PageHeight>11in</PageHeight>
                      <MarginTop>0.25in</MarginTop>
                      <MarginLeft>0.25in</MarginLeft>
                      <MarginRight>0.25in</MarginRight>
                      <MarginBottom>0.25in</MarginBottom>
                    </DeviceInfo>";

            string reportType = id;
            string mimeType;
            string encoding;
            string fileNameExtension;

            Warning[] warnings;
            string[]  streams;
            byte[]    renderedBytes;

            renderedBytes = lr.Render(
                reportType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);
            return(File(renderedBytes, mimeType));
        }