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 reportCacheKey30 = string.Concat("MMDSCDISummary30", year, month, Request.QueryString["Brand"],DRStatus); string reportCacheKey31 = string.Concat("MMDSCDISummary31", year, month, Request.QueryString["Brand"],DRStatus); string reportCacheKey28 = string.Concat("MMDSCDISummary28", year, month, Request.QueryString["Brand"],DRStatus); string reportCacheKey29 = string.Concat("MMDSCDISummary29", 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[reportCacheKey30] != null) { REPORT_DOC = (RptCDISummaryMMDS30)Cache[reportCacheKey30]; } else { REPORT_DOC = new RptCDISummaryMMDS30(); Cache.Insert(reportCacheKey30, REPORT_DOC); } break; case 31: if (Cache[reportCacheKey31] != null) { REPORT_DOC = (RptCDISummaryMMDS)Cache[reportCacheKey31]; } else { REPORT_DOC = new RptCDISummaryMMDS(); Cache.Insert(reportCacheKey31, REPORT_DOC); } break; case 28: if (Cache[reportCacheKey28] != null) { REPORT_DOC = (RptCDISummaryMMDS28)Cache[reportCacheKey28]; } else { REPORT_DOC = new RptCDISummaryMMDS28(); Cache.Insert(reportCacheKey28, REPORT_DOC); } break; case 29: if (Cache[reportCacheKey29] != null) { REPORT_DOC = (RptCDISummaryMMDS29)Cache[reportCacheKey29]; } else { REPORT_DOC = new RptCDISummaryMMDS29(); Cache.Insert(reportCacheKey29, REPORT_DOC); } break; default: break; } DataBaseLogIn(REPORT_DOC); this.MMDSDRSummaryReport.ParameterFieldInfo = prmList; MMDSDRSummaryReport.ReportSource = REPORT_DOC; }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { RptCDISummaryMMDS30 rpt = new RptCDISummaryMMDS30(); rpt.Site = this.Site; return rpt; }