public ActionResult Download_PDF2()
        {
            universityContext university = new universityContext();

            ReportDocument rd = new ReportDocument();

            rd.Load(Path.Combine(Server.MapPath("~/Reportss"), "CrystalReport2.rpt"));
            rd.SetDataSource(university.Gqw.Select(c => new
            {
                GraduateId    = c.Graduate.LastName,
                TeacherId     = c.Teacher.LastName,
                Theme         = c.Theme,
                Grade         = c.Grade,
                ReviewerGrade = c.ReviewerGrade
            }).ToList());

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();


            rd.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
            rd.PrintOptions.ApplyPageMargins(new CrystalDecisions.Shared.PageMargins(5, 5, 5, 5));
            rd.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA5;

            Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            stream.Seek(0, SeekOrigin.Begin);

            logger.Info("Report dowloaded");

            return(File(stream, "application/pdf", "GQWReport.pdf"));
        }
 public SqlServerDbService(universityContext icontext)
 {
     iContext = icontext;
 }
Esempio n. 3
0
 public TeacherController(universityContext context)
 {
     _context = context;
 }
Esempio n. 4
0
 public StudentController(universityContext context)
 {
     _context = context;
 }