/Reports/GeneralReport.cs

http://github.com/khaneh/Orders · C# · 160 lines · 127 code · 15 blank · 18 comment · 0 complexity · 045c763ec99d17ee5309c8b557df82c8 MD5 · raw file

  1. using System;
  2. using System.ComponentModel;
  3. using CrystalDecisions.Shared;
  4. using CrystalDecisions.ReportSource;
  5. using CrystalDecisions.CrystalReports.Engine;
  6. namespace Reports
  7. {
  8. /// <summary>
  9. /// Summary description for GeneralReport.
  10. /// </summary>
  11. public class GeneralReport : ReportClass
  12. {
  13. private string fileName=null;
  14. public GeneralReport(string rptFileName)
  15. {
  16. fileName=rptFileName;
  17. }
  18. public override string ResourceName
  19. {
  20. get
  21. {
  22. return fileName;
  23. }
  24. set
  25. {
  26. // Do nothing
  27. }
  28. }
  29. [Browsable(false)]
  30. [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
  31. public CrystalDecisions.CrystalReports.Engine.Section ReportHeaderSection1
  32. {
  33. get
  34. {
  35. return this.ReportDefinition.Sections[0];
  36. }
  37. }
  38. [Browsable(false)]
  39. [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
  40. public CrystalDecisions.CrystalReports.Engine.Section PageHeaderSection1
  41. {
  42. get
  43. {
  44. return this.ReportDefinition.Sections[1];
  45. }
  46. }
  47. [Browsable(false)]
  48. [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
  49. public CrystalDecisions.CrystalReports.Engine.Section DetailSection1
  50. {
  51. get
  52. {
  53. return this.ReportDefinition.Sections[2];
  54. }
  55. }
  56. [Browsable(false)]
  57. [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
  58. public CrystalDecisions.CrystalReports.Engine.Section ReportFooterSection1
  59. {
  60. get
  61. {
  62. return this.ReportDefinition.Sections[3];
  63. }
  64. }
  65. [Browsable(false)]
  66. [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
  67. public CrystalDecisions.CrystalReports.Engine.Section PageFooterSection1
  68. {
  69. get
  70. {
  71. return this.ReportDefinition.Sections[4];
  72. }
  73. }
  74. }
  75. [System.Drawing.ToolboxBitmapAttribute(typeof(CrystalDecisions.Shared.ExportOptions), "report.bmp")]
  76. public class CachedGeneralReport : Component, ICachedReport
  77. {
  78. private string fileName=null;
  79. public CachedGeneralReport(string rptFileName)
  80. {
  81. fileName=rptFileName;
  82. }
  83. [Browsable(false)]
  84. [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
  85. public virtual bool IsCacheable
  86. {
  87. get
  88. {
  89. return true;
  90. }
  91. set
  92. {
  93. //
  94. }
  95. }
  96. [Browsable(false)]
  97. [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
  98. public virtual bool ShareDBLogonInfo
  99. {
  100. get
  101. {
  102. return false;
  103. }
  104. set
  105. {
  106. //
  107. }
  108. }
  109. [Browsable(false)]
  110. [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
  111. public virtual System.TimeSpan CacheTimeOut
  112. {
  113. get
  114. {
  115. return CachedReportConstants.DEFAULT_TIMEOUT;
  116. }
  117. set
  118. {
  119. //
  120. }
  121. }
  122. public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
  123. {
  124. GeneralReport rpt = new GeneralReport(fileName);
  125. rpt.Site = this.Site;
  126. return rpt;
  127. }
  128. public virtual string GetCustomizedCacheKey(RequestContext request)
  129. {
  130. String key = null;
  131. // // The following is the code used to generate the default
  132. // // cache key for caching report jobs in the ASP.NET Cache.
  133. // // Feel free to modify this code to suit your needs.
  134. // // Returning key == null causes the default cache key to
  135. // // be generated.
  136. //
  137. // key = RequestContext.BuildCompleteCacheKey(
  138. // request,
  139. // null, // sReportFilename
  140. // this.GetType(),
  141. // this.ShareDBLogonInfo );
  142. return key;
  143. }
  144. }
  145. }