/Reports/Receipt.aspx.cs
C# | 86 lines | 65 code | 11 blank | 10 comment | 2 complexity | d058c95f6f42006d5bca1193fb1b9a49 MD5 | raw file
1using System; 2using System.Collections; 3using System.ComponentModel; 4using System.Data; 5using System.Drawing; 6using System.Web; 7using System.Web.SessionState; 8using System.Web.UI; 9using System.Web.UI.WebControls; 10using System.Web.UI.HtmlControls; 11using CrystalDecisions.CrystalReports.Engine; 12using CrystalDecisions.Shared; 13 14namespace Reports 15{ 16 /// <summary> 17 /// Summary description for WebForm1. 18 /// </summary> 19 public class ReceiptWebForm : System.Web.UI.Page 20 { 21 protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1; 22 protected System.Web.UI.WebControls.Button Button1; 23 protected System.Web.UI.HtmlControls.HtmlForm Form1; 24 protected ReportManager rm = new ReportManager(); 25 Receipt crReport = new Receipt(); 26 string paramName= "Recept_ID"; 27 string param; 28 private void Page_Load(object sender, System.EventArgs e) 29 { 30 param = Request.QueryString.Get(paramName); 31 32 Boolean x = rm.initReport(crReport, CrystalReportViewer1, param, paramName); 33 if(!x) 34 { 35 Response.Write ("error: Parameter Needed"); 36 Response.End(); 37 } 38 } 39 40 #region Web Form Designer generated code 41 override protected void OnInit(EventArgs e) 42 { 43 // 44 // CODEGEN: This call is required by the ASP.NET Web Form Designer. 45 // 46 InitializeComponent(); 47 base.OnInit(e); 48 DataBind(); 49 } 50 51 /// <summary> 52 /// Required method for Designer support - do not modify 53 /// the contents of this method with the code editor. 54 /// </summary> 55 private void InitializeComponent() 56 { 57 this.Button1.Click += new System.EventHandler(this.Button1_Click); 58 this.Load += new System.EventHandler(this.Page_Load); 59 60 } 61 #endregion 62 63 private void Button1_Click(object sender, System.EventArgs e) 64 { 65 rm.SetPrinter(Request.UserHostAddress); 66 Boolean x = rm.printReport(crReport, CrystalReportViewer1, param, paramName); 67 if(x) 68 { 69 Response.Write("<br><br><br><br><br><br><br><br><br><br><br><br><br><font face=titr color=red size=5><center>"); 70 Response.Write(" ���� �� �� �ǁ�� <br>"); 71 Response.Write(" ���� ����"+crReport.PrintOptions.PrinterName); 72 Response.Write("</center></font>"); 73 74 } 75 else 76 { 77 Response.Write ("error: Problem in printing report"); 78 Response.End(); 79 } 80 81 82 83 } 84 85 } 86}