/Reports/GLDoc.aspx.cs

http://github.com/khaneh/Orders · C# · 90 lines · 66 code · 14 blank · 10 comment · 2 complexity · 74c1f4b7b45509fc1d9425c12e60be3b MD5 · raw file

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