public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { RptCDISummaryBTQ30 rpt = new RptCDISummaryBTQ30(); rpt.Site = this.Site; return rpt; }
private void InitializeReport() { int year = int.Parse(Request.QueryString["Year"]); int month = int.Parse(Request.QueryString["Month"]); string DRStatus = Request.QueryString["Status"]; int days_count = GetMonthDayCount(year, month); DateTime DateTo = new DateTime(year, month, days_count); DateTime DateFrom = new DateTime(year, month, 1); ReportDocument REPORT_DOC = new ReportDocument(); string reportCacheKey = string.Concat("BTQCDISummary", year, month, Request.QueryString["Brand"],DRStatus); ParameterField prmDateFrom = new ParameterField(); ParameterField prmDateTo = new ParameterField(); ParameterField prmBrand = new ParameterField(); ParameterField prmStatus = new ParameterField(); ParameterFields prmList = new ParameterFields(); prmDateFrom.ParameterFieldName = "@date_from_param"; prmDateTo.ParameterFieldName = "@date_to_param"; prmBrand.ParameterFieldName = "@brand_name"; prmStatus.ParameterFieldName = "@dr_status"; ParameterDiscreteValue prmDateFromValue = new ParameterDiscreteValue(); ParameterDiscreteValue prmDateToValue = new ParameterDiscreteValue(); ParameterDiscreteValue pramBrandValue = new ParameterDiscreteValue(); ParameterDiscreteValue prmStatusValue = new ParameterDiscreteValue(); prmDateFromValue.Value = DateFrom; prmDateToValue.Value = DateTo; pramBrandValue.Value = Request.QueryString["Brand"]; prmStatusValue.Value = DRStatus; prmDateFrom.CurrentValues.Add(prmDateFromValue); prmDateTo.CurrentValues.Add(prmDateToValue); prmBrand.CurrentValues.Add(pramBrandValue); prmStatus.CurrentValues.Add(prmStatusValue); prmList.Add(prmDateFrom); prmList.Add(prmDateTo); prmList.Add(prmBrand); prmList.Add(prmStatus); switch (days_count) { case 30: if (Cache[reportCacheKey] != null) { REPORT_DOC = (RptCDISummaryBTQ30)Cache[reportCacheKey]; } else { REPORT_DOC = new RptCDISummaryBTQ30(); Cache.Insert(reportCacheKey, REPORT_DOC); } break; case 31: if (Cache[reportCacheKey] != null) { REPORT_DOC = (RptCDISummaryBTQ31)Cache[reportCacheKey]; } else { REPORT_DOC = new RptCDISummaryBTQ31(); Cache.Insert(reportCacheKey, REPORT_DOC); } break; case 28: if (Cache[reportCacheKey] != null) { REPORT_DOC = (RptCDISummaryBTQ28)Cache[reportCacheKey]; } else { REPORT_DOC = new RptCDISummaryBTQ28(); Cache.Insert(reportCacheKey, REPORT_DOC); } break; case 29: if (Cache[reportCacheKey] != null) { REPORT_DOC = (RptCDISummaryBTQ29)Cache[reportCacheKey]; } else { REPORT_DOC = new RptCDISummaryBTQ29(); Cache.Insert(reportCacheKey, REPORT_DOC); } break; default: break; } DataBaseLogIn(REPORT_DOC); this.BTQDRSummaryReport.ParameterFieldInfo = prmList; BTQDRSummaryReport.ReportSource = REPORT_DOC; }