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("MINDANAOCDISummary", 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 = (RptCDISummaryMINDANAO30)Cache[reportCacheKey];
                    }
                    else
                    {
                        REPORT_DOC = new RptCDISummaryMINDANAO30();
                        Cache.Insert(reportCacheKey, REPORT_DOC);
                    }
                    break;
                case 31:
                    if (Cache[reportCacheKey] != null)
                    {
                        REPORT_DOC = (RptCDISummaryMINDANAO31)Cache[reportCacheKey];
                    }
                    else
                    {
                        REPORT_DOC = new RptCDISummaryMINDANAO31();
                        Cache.Insert(reportCacheKey, REPORT_DOC);
                    }
                    break;
                case 28:
                    if (Cache[reportCacheKey] != null)
                    {
                        REPORT_DOC = (RptCDISummaryMINDANAO28)Cache[reportCacheKey];
                    }
                    else
                    {
                        REPORT_DOC = new RptCDISummaryMINDANAO28();
                        Cache.Insert(reportCacheKey, REPORT_DOC);
                    }
                    break;
                case 29:
                    if (Cache[reportCacheKey] != null)
                    {
                        REPORT_DOC = (RptCDISummaryMINDANAO29)Cache[reportCacheKey];
                    }
                    else
                    {
                        REPORT_DOC = new RptCDISummaryMINDANAO29();
                        Cache.Insert(reportCacheKey, REPORT_DOC);
                    }
                    break;
                default:
                    break;
            }
            DataBaseLogIn(REPORT_DOC);
            this.MINDANAODRSummaryReport.ParameterFieldInfo = prmList;
            MINDANAODRSummaryReport.ReportSource = REPORT_DOC;
        }
コード例 #2
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     RptCDISummaryMINDANAO28 rpt = new RptCDISummaryMINDANAO28();
     rpt.Site = this.Site;
     return rpt;
 }