-
Notifications
You must be signed in to change notification settings - Fork 0
/
AgentStockPricesPDF.aspx.cs
50 lines (44 loc) · 1.53 KB
/
AgentStockPricesPDF.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace MGM_Transformer
{
public partial class AgentStockPricesPDF : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataValidation dv = new DataValidation();
string sPath = dv.CurrentDir(true);
string sFN = sPath + "pdfs//AgentStockPrices.pdf";
ReportDocument r = new ReportDocument();
try
{
string sRpt = "AgentStockPrices.rpt";
r.Load(System.AppDomain.CurrentDomain.BaseDirectory + sRpt);
sFN = "C:\\MGMQuotation\\pdfs\\AgentStockPrices.rpt";
r.ExportToDisk(ExportFormatType.PortableDocFormat, sFN);
System.Web.HttpContext.Current.Response.ClearContent();
System.Web.HttpContext.Current.Response.ClearHeaders();
System.Web.HttpContext.Current.Response.ContentType = "application/pdf";
System.Web.HttpContext.Current.Response.WriteFile(sFN);
}
catch (Exception ex)
{
Response.Write("Exception occurred: " + ex + ".");
}
finally
{
r.Dispose();
}
}
}
}