Пример #1
0
        public ActionResult DownloadAnex(int RntID)
        {
            byte[] bytes = null;
            //if (returnId == null)
            //    returnId = "0";
            //int catg = Convert.ToInt32(returnId.Substring(0, 1));
            //int RntID = Convert.ToInt32(returnId.Substring(1, returnId.Length - 1));
            string DocumetNAme = "";

            Microsoft.Reporting.WebForms.LocalReport rpt = new Microsoft.Reporting.WebForms.LocalReport();

            var DBvlu = db.AJ_Stud_Admin_Return_Reg_C(RntID);

            rpt.ReportPath = Server.MapPath(@"~/Reports/Regirstion_Reports/Rdlc_Affi_reg_return_Anax_C.rdlc");
            rpt.DataSources.Add(new ReportDataSource("Rdlc_Affi_reg_return_Anax_C", DBvlu));
            DocumetNAme = "Annex-C" + "." + "PDF";
            rpt.GetDefaultPageSettings();
            bytes = rpt.Render("PDF");


            // bytes = rpt.Render("PDF");
            if (bytes.Length > 0)
            {
                Response.Buffer = true;
                Response.Clear();
                Response.AddHeader("content-disposition", "attachment; filename=" + DocumetNAme);
                Response.OutputStream.Write(bytes, 0, bytes.Length); // create the file
                Response.Flush();                                    // send it to the client to download
                Response.End();
                //  return View();
            }
            return(RedirectToAction("ReturnStatus", "Registration"));
        }
Пример #2
0
 byte[] Laboratory(int Inst_ID)
 {
     using (UOSEntities db = new UOSEntities())
     {
         Microsoft.Reporting.WebForms.LocalReport rpt = new Microsoft.Reporting.WebForms.LocalReport();
         rpt.ReportPath = Server.MapPath(@"~/Aff_Reports/Aff_inst_AJ_Rep_Laboratory_INFO.rdlc");
         rpt.DataSources.Add(new ReportDataSource("AJ_Rep_Laboratory_INFO", db.AJ_Rep_Laboratory_INFO(Convert.ToInt32(Inst_ID))));
         return(rpt.Render("PDF"));
     }
 }
Пример #3
0
        byte[] Download_Rpt_Insitut_info(int Inst_ID)
        {
            using (UOSEntities db = new UOSEntities())
            {
                Microsoft.Reporting.WebForms.LocalReport rpt = new Microsoft.Reporting.WebForms.LocalReport();
                rpt.ReportPath = Server.MapPath(@"~/Aff_Reports/Rpt_Affi_Instu_Info.rdlc");
                rpt.DataSources.Add(new ReportDataSource("AJ_Affi_Ins_Pop_Instu_Info", db.AJ_Affi_Ins_Pop_Instu_Info(Convert.ToInt32(Inst_ID))));

                return(rpt.Render("PDF"));
            }
        }
Пример #4
0
        byte[] Download_Rpt_Non_Requir_info(int Inst_ID)
        {
            using (UOSEntities db = new UOSEntities())
            {
                Microsoft.Reporting.WebForms.LocalReport rpt = new Microsoft.Reporting.WebForms.LocalReport();
                rpt.ReportPath = Server.MapPath(@"~/Aff_Reports/Aff_ins_Non_Recuring_INFO.rdlc");
                rpt.DataSources.Add(new ReportDataSource("AJ_Rep_Non_Recuring_INFO", db.AJ_Rep_Non_Recuring_INFO(Convert.ToInt32(Inst_ID))));

                return(rpt.Render("PDF"));
            }
        }
Пример #5
0
        byte[] Download_Rpt_Staff_info(int Inst_ID, int cag)
        {
            using (UOSEntities db = new UOSEntities())
            {
                Microsoft.Reporting.WebForms.LocalReport rpt = new Microsoft.Reporting.WebForms.LocalReport();
                rpt.ReportPath = Server.MapPath(@"~/Aff_Reports/Aff_Inst_Staff_Info.rdlc");
                rpt.DataSources.Add(new ReportDataSource("AJ_Rep_Employee_INFO", db.AJ_Rep_Employee_INFO(Convert.ToInt32(Inst_ID), cag)));

                return(rpt.Render("PDF"));
            }
        }
Пример #6
0
        byte[] Download_Rpt_Libaray_info(int Inst_ID)
        {
            using (UOSEntities db = new UOSEntities())
            {
                Microsoft.Reporting.WebForms.LocalReport rpt = new Microsoft.Reporting.WebForms.LocalReport();
                rpt.ReportPath = Server.MapPath(@"~/Aff_Reports/Aff_Inst_Library_INFO.rdlc");
                rpt.DataSources.Add(new ReportDataSource("AJ_Rep_Library_INFO", db.AJ_Rep_Library_INFO(Convert.ToInt32(Inst_ID))));
                rpt.DataSources.Add(new ReportDataSource("Affi_ins_Rep_OtherFacilities_INFO", db.AJ_Affi_ins_Rep_OtherFacilities_INFO(Convert.ToInt32(Inst_ID))));

                return(rpt.Render("PDF"));
            }
        }
Пример #7
0
        public static byte[] GeReportStreamPDF(string reportName, string dataSetName, object dataSet, string reportPath, List <Microsoft.Reporting.WebForms.ReportParameter> parameters = null, Dictionary <string, object> dataSets = null)
        {
            Microsoft.Reporting.WebForms.LocalReport report = new Microsoft.Reporting.WebForms.LocalReport();
            report.EnableExternalImages = true;
            report.ReportPath           = reportPath + "/" + reportName + ".rdlc";
            if (parameters.Count() > 0)
            {
                report.SetParameters(parameters);
            }


            ReportDataSource rds = new ReportDataSource();

            rds.Name  = dataSetName;
            rds.Value = dataSet;
            report.DataSources.Add(rds);

            if (dataSets != null)
            {
                foreach (KeyValuePair <string, object> kvp in dataSets)
                {
                    ReportDataSource reportDataSource = new ReportDataSource();
                    reportDataSource.Name  = kvp.Key;
                    reportDataSource.Value = kvp.Value;
                    report.DataSources.Add(reportDataSource);
                }
            }

            string deviceInfo = null; // http://msdn2.microsoft.com/en-us/library/ms155397.aspx
            string mimeType;
            string encoding;
            string fileNameExtension;

            string[] streams;
            Microsoft.Reporting.WebForms.Warning[] warnings;

            byte[] renderedBytes = report.Render(
                "PDF",
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);

            return(renderedBytes);
        }
Пример #8
0
        public ActionResult DownloadForm(string appId)
        {
            obj = GetData();

            Microsoft.Reporting.WebForms.LocalReport rpt = new Microsoft.Reporting.WebForms.LocalReport();
            rpt.ReportPath = Server.MapPath(@"~/Aff_Reports/Rep_Affi_Ins_Visting_Member.rdlc");
            rpt.DataSources.Add(new ReportDataSource("AJ_Aff_Ins_Vist_Rep_Commety", db.AJ_Aff_Ins_Vist_Rep_Commety(Convert.ToInt32(appId))));
            rpt.DataSources.Add(new ReportDataSource("AJ_Aff_Ins_Vist_Rep_MEmBEr_Commety", db.AJ_Aff_Ins_Vist_Rep_MEmBEr_Commety(Convert.ToInt32(obj.Institute_Id))));

            byte[] bytes = rpt.Render("PDF");
            Response.Buffer = true;
            Response.Clear();
            Response.AddHeader("content-disposition", "attachment; filename= Application" + "." + "PDF");
            Response.OutputStream.Write(bytes, 0, bytes.Length); // create the file
            Response.Flush();                                    // send it to the client to download
            Response.End();
            //return View();
            //return Json("Secuss", JsonRequestBehavior.AllowGet);
            return(View());
        }
Пример #9
0
        protected void generate_report_ServerClick(object sender, EventArgs e)
        {
            int briefId = 1;

            ReportGenerator rg = new ReportGenerator(Server.MapPath("~/download/") + Session.SessionID + ".rdlc");

            rg.ChartImagePath = Server.MapPath("~/chart-images/");
            string reportPath = rg.Generate(briefId);

            string fileName     = "File_" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".docx";
            string fullFilePath = Server.MapPath("~/download/") + fileName;
            string extension    = string.Empty;
            string encoding     = string.Empty;
            string mimeType     = string.Empty;

            string[]      streams;
            MRW.Warning[] warnings;

            MRW.LocalReport report = new MRW.LocalReport();
            report.ReportPath = reportPath;
            report.SetParameters(GetReportParameters(briefId));
            Byte[] mybytes = report.Render("WORDOPENXML", null,
                                           out mimeType, out encoding,
                                           out extension, out streams, out warnings);
            using (FileStream fs = File.Create(fullFilePath))
            {
                fs.Write(mybytes, 0, mybytes.Length);
            }

            Response.ClearHeaders();
            Response.ClearContent();
            Response.Buffer = true;
            Response.Clear();
            Response.ContentType = mimeType;
            Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
            Response.WriteFile(fullFilePath);
            Response.Flush();
            Response.Close();
            Response.End();
        }
Пример #10
0
        public static HttpResponseMessage Report(DataTable ds, string dsName, string rdlc)
        {
            var report = new Microsoft.Reporting.WebForms.LocalReport();

            report.ReportPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Bin/Report/" + rdlc);
            report.DataSources.Add(new ReportDataSource(dsName, ds));
            report.Refresh();

            string mimeType          = "";
            string encoding          = "";
            string filenameExtension = "";

            string[] streams = null;
            Microsoft.Reporting.WebForms.Warning[] warnings = null;
            byte[] bytes = report.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streams, out warnings);

            HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);

            result.Content = new ByteArrayContent(bytes);
            result.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(mimeType);
            return(result);
        }
Пример #11
0
 // metodos para imprimir o BE
 private static void ExportarEtiq(Microsoft.Reporting.WebForms.LocalReport etiqueta)
 {
     Microsoft.Reporting.WebForms.Warning[] warnings;
     LimparStreams();
     etiqueta.Render("image", CriarDeviceInfoEtique(etiqueta), CreateStreamCallback, out warnings);
 }
Пример #12
0
 // metodos para imprimir o BE
 private static void Exportar(Microsoft.Reporting.WebForms.LocalReport relatorio)
 {
     Microsoft.Reporting.WebForms.Warning[] warnings;
     LimparStreams();
     relatorio.Render("image", CriarDeviceInfo(relatorio), CreateStreamCallback, out warnings);
 }
Пример #13
0
        public ActionResult DetailsReport()
        {
            LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport();

            string deviceInfo = "<DeviceInfo>" +
            " <OutputFormat>PDF</OutputFormat>" +
            " <PageWidth>8.5in</PageWidth>" +
            " <PageHeight>11in</PageHeight>" +
            " <MarginTop>0.5in</MarginTop>" +
            " <MarginLeft>1in</MarginLeft>" +
            " <MarginRight>1in</MarginRight>" +
            " <MarginBottom>0.5in</MarginBottom>" +
            "</DeviceInfo>";

            lr.ReportPath = Server.MapPath("~/Rapor/Birim.rdlc");

            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["matbaaConnectionString"].ConnectionString);
            conn.Open();
            SqlDataAdapter adap = new SqlDataAdapter("select * from Birim", conn);

            DataSet ds = new DataSet();
            adap.Fill(ds);
            conn.Close();

            lr.DataSources.Clear();
            lr.DataSources.Add(
            new ReportDataSource("DataSetBirim", ds.Tables[0]));
            Warning[] warnings; string mimeType; string encoding; string[] streamids; string fne;
            byte[] bytes = lr.Render("PDF", deviceInfo, out mimeType, out encoding, out fne, out streamids, out warnings);
            return File(bytes, mimeType);
        }