Exemple #1
0
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        if (QueryHelper.ValidateHash("hash", "UILang"))
        {
            // Get report name
            string reportName = QueryHelper.GetString("reportName", null);

            // Check permissions
            bool isEcommerceReport = ReportInfoProvider.IsEcommerceReport(reportName);
            CMSEcommerceReportsPage.CheckPermissions(isEcommerceReport);

            ReportInfo report = ReportInfoProvider.GetReportInfo(reportName);
            if (report != null)
            {
                // Get report parameters
                string  parameters       = QueryHelper.GetString("parameters", String.Empty);
                DataRow reportParameters = ReportHelper.GetReportParameters(report, parameters, null, CultureHelper.EnglishCulture);

                // Init report
                if (reportParameters != null)
                {
                    DisplayReport1.LoadFormParameters = false;
                    DisplayReport1.ReportParameters   = reportParameters;
                }

                DisplayReport1.ReportName    = reportName;
                DisplayReport1.DisplayFilter = false;

                Page.Title = GetString("report_print.lblprintreport") + " " + HTMLHelper.HTMLEncode(report.ReportDisplayName);
            }
        }
    }
Exemple #2
0
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        ManagersContainer = plcContainerManager;

        // For purposes of IsEcommerceReport its sufficient to get report name of any period (year,month,week)
        string reportCodeName = QueryHelper.GetString("reportCodeName", String.Empty);
        string name           = ucReportViewer.GetReportCodeName(reportCodeName);

        // No interval report (only one report in url - pass it now
        if (!reportCodeName.Contains(";"))
        {
            ucReportViewer.ReportName = name;
        }

        IsEcommerceReport = ReportInfoProvider.IsEcommerceReport(name);

        // To display filter form control (basic form) need to pass report name before control's init
        // To set fields before basic form control state fills them with actual data
        bool displayFilter = QueryHelper.GetBoolean("displayFilter", false);

        if (displayFilter)
        {
            ucReportViewer.LoadFormParameters     = true;
            ucReportViewer.DisplayReportBodyClass = "DisplayReportBody";
        }
    }
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        // Get report name
        string reportName = QueryHelper.GetString("reportName", null);

        // Check permissions
        bool isEcommerceReport = ReportInfoProvider.IsEcommerceReport(reportName);

        CMSEcommerceReportsPage.CheckPermissions(isEcommerceReport);

        SetCulture();

        ReportInfo report = ReportInfoProvider.GetReportInfo(reportName);

        if (report != null)
        {
            // Get report parameters
            string          parameters     = QueryHelper.GetString("parameters", "");
            IFormatProvider culture        = DateTimeHelper.DefaultIFormatProvider;
            IFormatProvider currentCulture = new CultureInfo(Thread.CurrentThread.CurrentUICulture.IetfLanguageTag);
            DataRow         drParameters   = ReportHelper.GetReportParameters(report, parameters, null, culture, currentCulture);

            // Init report
            if (drParameters != null)
            {
                DisplayReport1.LoadFormParameters = false;
                DisplayReport1.ReportParameters   = drParameters;
            }

            DisplayReport1.ReportName    = reportName;
            DisplayReport1.DisplayFilter = false;

            Page.Title = GetString("report_print.lblprintreport") + " " + HTMLHelper.HTMLEncode(report.ReportDisplayName);
        }
    }
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        CMSEcommerceReportingPage.CheckSecurity();

        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Ecommerce", CMSContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Ecommerce");
        }
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Reporting", CMSContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Reporting");
        }

        CurrentUserInfo user = CMSContext.CurrentUser;

        // Get report name from querystring
        reportName = QueryHelper.GetString("reportname", "");

        // Check module permissions
        if (ReportInfoProvider.IsEcommerceReport(reportName))
        {
            if (!user.IsAuthorizedPerResource("CMS.Ecommerce", "EcommerceRead") && !user.IsAuthorizedPerResource("CMS.Ecommerce", "ReadReports"))
            {
                RedirectToCMSDeskAccessDenied("CMS.Ecommerce", "EcommerceRead OR ReadReports");
            }
        }
        else
        {
            if (!user.IsAuthorizedPerResource("CMS.Reporting", "Read"))
            {
                RedirectToAccessDenied("CMS.Reporting", "Read");
            }
        }

        // Get parameters from querystring
        string[] httpParameters = QueryHelper.GetString("parameters", "").Split(";".ToCharArray());

        if (httpParameters.Length > 1)
        {
            string[] parameters = new string[httpParameters.Length / 2];

            DataTable dtp = new DataTable();

            // Create correct columns and put values in it
            for (int i = 0; i < httpParameters.Length; i = i + 2)
            {
                dtp.Columns.Add(httpParameters[i]);
                parameters[i / 2] = httpParameters[i + 1];
            }


            dtp.Rows.Add(parameters);
            dtp.AcceptChanges();

            DisplayReport1.LoadFormParameters = false;
            DisplayReport1.ReportName         = reportName;
            DisplayReport1.DisplayFilter      = false;
            DisplayReport1.ReportParameters   = dtp.Rows[0];
        }
        else
        {
            DisplayReport1.ReportName    = reportName;
            DisplayReport1.DisplayFilter = false;
        }
        this.Page.Title = GetString("Report_Print.lblPrintReport") + " " + reportName;
    }