示例#1
0
        public void GenerateClassExamReport(string studentId, string resultFormatFileName)
        {
            try
            {
                ReportViewer1.ProcessingMode = ProcessingMode.Local;

                ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/App/Report/" + resultFormatFileName);
                PROC_EXAMREPORTGENERATETableAdapter rpt = new PROC_EXAMREPORTGENERATETableAdapter();

                //PROC_RPT_STUDENTTableAdapter
                //var Org = orgDTO.GetORGANIZATION(cls_Common.UserProfile.ORG_ID);
                //var OrganisationName_Address = Org.Name +"\n"+ Org.Address;
                // ReportParameter rpm = new ReportParameter("SchoolName_Address",OrganisationName_Address);
                // ReportViewer1.LocalReport.SetParameters(rpm);
                //MST_STUDENT_ATTENDANCETableAdapter rpt = new MST_STUDENT_ATTENDANCETableAdapter();
                //// StudentInfo
                DataTable        ds  = rpt.GetData(studentId);
                ReportDataSource rds = new ReportDataSource("dsExamResult", ds);
                ReportViewer1.LocalReport.DataSources.Clear();
                //Add ReportDataSource
                ReportViewer1.LocalReport.DataSources.Add(rds);
            }
            catch (Exception ex)
            {
            }
        }
示例#2
0
        public void GenerateClassExamReportDownloadPDF(string studentId, string fileName)
        {
            try
            {
                Warning[]    warnings;
                string[]     streams;
                string       MIMETYPE  = string.Empty;
                string       encoding  = string.Empty;
                string       extension = string.Empty;
                ReportViewer rptviewer = new ReportViewer();
                rptviewer.ProcessingMode = ProcessingMode.Local;

                rptviewer.LocalReport.ReportPath = Server.MapPath("~/App/Report/" + uc_ResultFormat.SelectedValue);
                PROC_EXAMREPORTGENERATETableAdapter rpt = new PROC_EXAMREPORTGENERATETableAdapter();

                //PROC_RPT_STUDENTTableAdapter
                //var Org = orgDTO.GetORGANIZATION(cls_Common.UserProfile.ORG_ID);
                //var OrganisationName_Address = Org.Name +"\n"+ Org.Address;
                // ReportParameter rpm = new ReportParameter("SchoolName_Address",OrganisationName_Address);
                // ReportViewer1.LocalReport.SetParameters(rpm);
                //MST_STUDENT_ATTENDANCETableAdapter rpt = new MST_STUDENT_ATTENDANCETableAdapter();
                //// StudentInfo
                DataTable        ds  = rpt.GetData(studentId);
                ReportDataSource rds = new ReportDataSource("dsExamResult", ds);
                rptviewer.LocalReport.DataSources.Clear();
                //Add ReportDataSource
                rptviewer.LocalReport.DataSources.Add(rds);
                byte[] bytes = rptviewer.LocalReport.Render("pdf", null, out MIMETYPE, out encoding, out extension, out streams, out warnings);
                Response.Buffer = true;
                Response.Clear();
                Response.ContentType = MIMETYPE;
                Response.AddHeader("content-disposition", "attachment; filename=" + fileName + "." + extension);
                Response.BinaryWrite(bytes);
                Response.Flush();
            }
            catch (Exception ex)
            {
            }
        }