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