コード例 #1
0
        public rptGraders()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            GradingByCollection obj = new GradingByCollection();

            if (HttpContext.Current.Session["GradersCodeReport"] != null)
            {
                obj = (GradingByCollection)HttpContext.Current.Session["GradersCodeReport"];
            }
        }
コード例 #2
0
 protected void gvCodeGenerated_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     this.lblMsg.Text = "";
     if (e.CommandName == "Print")
     {
         int         index = Convert.ToInt32(e.CommandArgument);
         GridViewRow rw    = this.gvCodeGenerated.Rows[index];
         Label       lblId = (Label)rw.FindControl("lblId");
         Guid        Id    = Guid.Empty;
         try
         {
             Id = new Guid(lblId.Text);
             if (Id != Guid.Empty)
             {
                 GradingBLL objCodeReport = new GradingBLL();
                 objCodeReport         = objCodeReport.GetById(Id);
                 Session["CodeReport"] = objCodeReport;
                 List <GradingByBLL> list       = new List <GradingByBLL>();
                 GradingByBLL        objGraders = new GradingByBLL();
                 list = objGraders.GetByGradingId(objCodeReport.Id);
                 GradingByCollection objGraderCollection = new GradingByCollection(list);
                 Session["GradersCodeReport"] = objGraderCollection;
                 StringBuilder sb = new StringBuilder();
                 sb.Append("<script>");
                 sb.Append("window.open('rptCoffeeCode.aspx");
                 sb.Append("', '', 'toolbar=0');");
                 sb.Append("</scri");
                 sb.Append("pt>");
                 ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ShowReport",
                                                         sb.ToString(), false);
             }
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GradingByCollection objCollection = (GradingByCollection)Session["GradersCodeReport"];
            ActiveReport        rt            = new WarehouseApplication.Reports.CoffeeCodingReport();

            rt.Run(false);
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "inline; filename=SampleTicket.PDF");

            rt.DataSource = objCollection;

            // Create the PDF export object
            PdfExport pdf = new PdfExport();

            // Create a new memory stream that will hold the pdf output
            System.IO.MemoryStream memStream = new System.IO.MemoryStream();
            // Export the report to PDF:
            pdf.Export(rt.Document, memStream);
            // Write the PDF stream out
            Response.BinaryWrite(memStream.ToArray());
            // Send all buffered content to the client
            Response.End();
        }