Exemplo n.º 1
0
        protected void ExportPdfBtn_Click(object sender, EventArgs e)
        {
            RoutersReport p        = GetReport();
            string        format   = "Pdf";
            string        fileName = String.Format("Report.{0}", format);

            MemoryStream ms = new MemoryStream();

            p.ExportToPdf(ms);
            Response.Clear();

            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", String.Format("{0}; filename={1}", "attachment", fileName));
            Response.BinaryWrite(ms.ToArray());
            Response.Flush();
            Response.Close();
            //Response.Redirect("Reports/RT301.aspx");
        }
Exemplo n.º 2
0
        private RoutersReport GetReport()
        {
            ListRequest request = new ListRequest();

            request.Filter = "";
            ListResponse <Router> resp = _timeAttendanceService.ChildGetAll <Router>(request);

            if (!resp.Success)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                Common.errorMessage(resp);
                return(null);
            }
            RoutersReport p = new RoutersReport();

            p.DataSource = resp.Items;
            p.Parameters["User"].Value = _systemService.SessionHelper.GetCurrentUser();
            p.RightToLeft             = _systemService.SessionHelper.CheckIfArabicSession() ? DevExpress.XtraReports.UI.RightToLeft.Yes : DevExpress.XtraReports.UI.RightToLeft.No;
            p.RightToLeftLayout       = _systemService.SessionHelper.CheckIfArabicSession() ? DevExpress.XtraReports.UI.RightToLeftLayout.Yes : DevExpress.XtraReports.UI.RightToLeftLayout.No;
            p.Parameters["Yes"].Value = GetGlobalResourceObject("Common", "Yes").ToString();
            p.Parameters["No"].Value  = GetGlobalResourceObject("Common", "No").ToString();
            return(p);
        }
Exemplo n.º 3
0
        protected void printBtn_Click(object sender, EventArgs e)
        {
            RoutersReport p        = GetReport();
            string        format   = "Pdf";
            string        fileName = String.Format("Report.{0}", format);

            MemoryStream ms = new MemoryStream();

            p.ExportToPdf(ms, new DevExpress.XtraPrinting.PdfExportOptions()
            {
                ShowPrintDialogOnOpen = true
            });
            Response.Clear();
            Response.Write("<script>");
            Response.Write("window.document.forms[0].target = '_blank';");
            Response.Write("setTimeout(function () { window.document.forms[0].target = ''; }, 0);");
            Response.Write("</script>");
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", String.Format("{0}; filename={1}", "inline", fileName));
            Response.BinaryWrite(ms.ToArray());
            Response.Flush();
            Response.Close();
            //Response.Redirect("Reports/RT301.aspx");
        }