예제 #1
0
    protected override void OnPreInit(EventArgs e)
    {
        UIContext["excludedhashparameters"] = "UILang";

        base.OnPreInit(e);

        // Get report info
        string     reportName = QueryHelper.GetString("reportname", String.Empty);
        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)
            {
                DisplayReport.LoadFormParameters = false;
                DisplayReport.ReportParameters   = reportParameters;
            }

            DisplayReport.ReportName    = report.ReportName;
            DisplayReport.DisplayFilter = false;

            Page.Title = GetString("Report_Print.lblPrintReport") + " " + HTMLHelper.HTMLEncode(report.ReportDisplayName);
        }
    }
예제 #2
0
    /// <summary>
    /// Creates report value. Called when the "Create value" button is pressed.
    /// </summary>
    private bool CreateReportValue()
    {
        // Get report object by report code name
        ReportInfo report = ReportInfoProvider.GetReportInfo("MyNewReport");

        // If report exists
        if (report != null)
        {
            // Create new report value object
            ReportValueInfo newValue = new ReportValueInfo();

            // Set the properties
            newValue.ValueDisplayName            = "My new value";
            newValue.ValueName                   = "MyNewValue";
            newValue.ValueQuery                  = "SELECT COUNT(DocumentName) FROM CMS_Document";
            newValue.ValueQueryIsStoredProcedure = false;
            newValue.ValueReportID               = report.ReportID;

            // Save the report value
            ReportValueInfoProvider.SetReportValueInfo(newValue);

            return(true);
        }
        return(false);
    }
예제 #3
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";
        }
    }
예제 #4
0
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        // Set cultures
        SetCulture();

        // Get report info
        int        reportId = QueryHelper.GetInteger("reportid", 0);
        ReportInfo report   = ReportInfoProvider.GetReportInfo(reportId);

        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)
            {
                DisplayReport.LoadFormParameters = false;
                DisplayReport.ReportParameters   = reportParameters;
            }

            DisplayReport.ReportName    = report.ReportName;
            DisplayReport.DisplayFilter = false;

            Page.Title = GetString("Report_Print.lblPrintReport") + " " + HTMLHelper.HTMLEncode(report.ReportDisplayName);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        mEmail = QueryHelper.GetString(Server.UrlDecode("email"), String.Empty);
        Guid subscriptionGUID = QueryHelper.GetGuid("guid", Guid.Empty);

        mReportSubscriptionInfo = ReportSubscriptionInfoProvider.GetReportSubscriptionInfo(subscriptionGUID);
        if (mReportSubscriptionInfo != null)
        {
            mReportInfo = ReportInfoProvider.GetReportInfo(mReportSubscriptionInfo.ReportSubscriptionReportID);
            if (mReportInfo != null)
            {
                // Set info label based by subscription's report
                lblInfo.Text = String.Format(GetString("reportsubscription.unsubscription.info"), HTMLHelper.HTMLEncode(mEmail), HTMLHelper.HTMLEncode(mReportInfo.ReportDisplayName));
            }
        }
        else
        {
            ShowError(GetString("reportsubscription.notfound"));
            pnlInfo.Visible        = false;
            btnUnsubscribe.Enabled = false;
        }

        btnUnsubscribe.Text = GetString("reportsubscription.unsubscribe");
        Title = GetString("reportsubscription.unsubscribe.title");

        PageTitle.TitleText = GetString("reportsubscription.unsubscribe.title");
    }
예제 #6
0
    /// <summary>
    /// Handles the UniGrid's OnAction event.
    /// </summary>
    /// <param name="actionName">Name of item (button) that throws event</param>
    /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
    protected void uniGrid_OnAction(string actionName, object actionArgument)
    {
        int reportId = ValidationHelper.GetInteger(actionArgument, 0);

        switch (actionName)
        {
        case "delete":
            // Check 'Modify' permission
            if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "Modify"))
            {
                RedirectToAccessDenied("cms.reporting", "Modify");
            }

            // Delete ReportInfo object from database
            ReportInfoProvider.DeleteReportInfo(reportId);

            // Refresh tree after delete
            ltlScript.Text += ScriptHelper.GetScript("RefreshAdditionalContent();");
            break;

        case "clone":
            Clone(reportId);
            break;
        }
    }
예제 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        email = QueryHelper.GetString(Server.UrlDecode("email"), String.Empty);
        Guid subscriptionGUID = QueryHelper.GetGuid("guid", Guid.Empty);

        rsi = ReportSubscriptionInfoProvider.GetReportSubscriptionInfo(subscriptionGUID);
        if (rsi != null)
        {
            ri = ReportInfoProvider.GetReportInfo(rsi.ReportSubscriptionReportID);
            if (ri != null)
            {
                // Set info label based by subscription's report
                lblInfo.Text = String.Format(GetString("reportsubscription.unsubscription.info"), email, ri.ReportDisplayName);
            }
        }
        else
        {
            ShowError(GetString("reportsubscription.notfound"));
            pnlInfo.Visible        = false;
            btnUnsubscribe.Enabled = false;
        }

        btnUnsubscribe.Text = GetString("reportsubscription.unsubscribe");
        Title = GetString("reportsubscription.unsubscribe.title");

        CurrentMaster.Title.TitleText  = GetString("reportsubscription.unsubscribe.title");
        CurrentMaster.Title.TitleImage = GetImageUrl("/CMSModules/CMS_Reporting/Subscription24.png");
    }
예제 #8
0
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        if (QueryHelper.ValidateHash("hash", "UILang"))
        {
            // Check security
            CheckSecurity();

            // Get report info
            string     reportName = QueryHelper.GetString("reportname", String.Empty);
            ReportInfo report     = ReportInfoProvider.GetReportInfo(reportName);

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

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

                displayReport.ReportName    = report.ReportName;
                displayReport.DisplayFilter = false;

                Page.Title = GetString("Report_Print.lblPrintReport") + " " + HTMLHelper.HTMLEncode(report.ReportDisplayName);
            }
        }
    }
예제 #9
0
    private bool InsertElementsToLayout()
    {
        // Get report object by report code name
        ReportInfo report = ReportInfoProvider.GetReportInfo("MyNewReport");

        // If report exists
        if (report != null)
        {
            ReportGraphInfo graph = ReportGraphInfoProvider.GetReportGraphInfo("MyNewGraph");
            if (graph != null)
            {
                report.ReportLayout += "<br/>%%control:Report" + ReportItemType.Graph + "?" + report.ReportName + "." + graph.GraphName + "%%<br/>";
            }

            ReportTableInfo table = ReportTableInfoProvider.GetReportTableInfo("MyNewTable");
            if (table != null)
            {
                report.ReportLayout += "<br/>%%control:Report" + ReportItemType.Table + "?" + report.ReportName + "." + table.TableName + "%%<br/>";
            }

            ReportValueInfo value = ReportValueInfoProvider.GetReportValueInfo("MyNewValue");
            if (value != null)
            {
                report.ReportLayout += "<br/>%%control:Report" + ReportItemType.Value + "?" + report.ReportName + "." + value.ValueName + "%%<br/>";
            }

            ReportInfoProvider.SetReportInfo(report);

            return(true);
        }
        return(false);
    }
예제 #10
0
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        // Check security
        CheckSecurity();

        // Set cultures
        SetCulture();
        IFormatProvider culture        = DateTimeHelper.DefaultIFormatProvider;
        IFormatProvider currentCulture = new CultureInfo(Thread.CurrentThread.CurrentUICulture.IetfLanguageTag);

        // Get report info
        string     reportName = ValidationHelper.GetString(Request.QueryString["reportname"], "");
        ReportInfo report     = ReportInfoProvider.GetReportInfo(reportName);

        if (report != null)
        {
            // Get report parameters
            string  parameters   = QueryHelper.GetString("parameters", "");
            DataRow drParameters = ReportHelper.GetReportParameters(report, parameters, AnalyticsHelper.PARAM_SEMICOLON, culture, currentCulture);

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

            DisplayReport1.ReportName    = report.ReportName;
            DisplayReport1.DisplayFilter = false;

            Page.Title = GetString("Report_Print.lblPrintReport") + " " + HTMLHelper.HTMLEncode(report.ReportDisplayName);
        }
    }
예제 #11
0
    /// <summary>
    /// Creates report table. Called when the "Create table" button is pressed.
    /// </summary>
    private bool CreateReportTable()
    {
        // Get report object by report code name
        ReportInfo report = ReportInfoProvider.GetReportInfo("MyNewReport");

        // If report exists
        if (report != null)
        {
            // Create new report table object
            ReportTableInfo newTable = new ReportTableInfo();

            // Set the properties
            newTable.TableDisplayName            = "My new table";
            newTable.TableName                   = "MyNewTable";
            newTable.TableQuery                  = "SELECT TOP 10 DocumentName, DocumentID FROM CMS_Document";
            newTable.TableReportID               = report.ReportID;
            newTable.TableQueryIsStoredProcedure = false;

            // Save the report table
            ReportTableInfoProvider.SetReportTableInfo(newTable);

            return(true);
        }
        return(false);
    }
예제 #12
0
    /// <summary>
    /// Creates report graph. Called when the "Create graph" button is pressed.
    /// </summary>
    private bool CreateReportGraph()
    {
        // Get report object by report code name
        ReportInfo report = ReportInfoProvider.GetReportInfo("MyNewReport");

        // If report exists
        if (report != null)
        {
            // Create new report graph object
            ReportGraphInfo newGraph = new ReportGraphInfo();

            // Set the properties
            newGraph.GraphDisplayName            = "My new graph";
            newGraph.GraphName                   = "MyNewGraph";
            newGraph.GraphQuery                  = "SELECT TOP 10 DocumentName, DocumentID FROM CMS_Document";
            newGraph.GraphReportID               = report.ReportID;
            newGraph.GraphQueryIsStoredProcedure = false;
            newGraph.GraphType                   = "bar";

            // Save the report graph
            ReportGraphInfoProvider.SetReportGraphInfo(newGraph);

            return(true);
        }

        return(false);
    }
예제 #13
0
    /// <summary>
    /// Gets and bulk updates reports. Called when the "Get and bulk update reports" button is pressed.
    /// Expects the CreateReport method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateReports()
    {
        // Prepare the parameters
        string where = "ReportName LIKE N'MyNewReport%'";
        string orderby = "";
        int    topN    = 0;
        string columns = "";

        // Get the data
        DataSet reports = ReportInfoProvider.GetReports(where, orderby, topN, columns);

        if (!DataHelper.DataSourceIsEmpty(reports))
        {
            // Loop through the individual items
            foreach (DataRow reportDr in reports.Tables[0].Rows)
            {
                // Create object from DataRow
                ReportInfo modifyReport = new ReportInfo(reportDr);

                // Update the properties
                modifyReport.ReportDisplayName = modifyReport.ReportDisplayName.ToUpper();

                // Save the changes
                ReportInfoProvider.SetReportInfo(modifyReport);
            }

            return(true);
        }

        return(false);
    }
예제 #14
0
    /// <summary>
    /// Creates report. Called when the "Create report" button is pressed.
    /// </summary>
    private bool CreateReport()
    {
        // Get the report category
        ReportCategoryInfo category = ReportCategoryInfoProvider.GetReportCategoryInfo("MyNewCategory");

        if (category != null)
        {
            // Create new report object
            ReportInfo newReport = new ReportInfo();

            // Set the properties
            newReport.ReportDisplayName = "My new report";
            newReport.ReportName        = "MyNewReport";
            newReport.ReportCategoryID  = category.CategoryID;
            newReport.ReportAccess      = ReportAccessEnum.All;
            newReport.ReportLayout      = "";
            newReport.ReportParameters  = "";

            // Save the report
            ReportInfoProvider.SetReportInfo(newReport);

            return(true);
        }
        return(false);
    }
예제 #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!AuthorizedForContacts)
        {
            // User has no permissions
            RedirectToAccessDenied(ModuleName.CONTACTMANAGEMENT, "Read");
        }

        // Set report parameters
        ReportInfo report = ReportInfoProvider.GetReportInfo("Number_of_contacts_in_steps");

        if (report != null)
        {
            ucReport.ReportName     = report.ReportName;
            reportHeader.ReportName = report.ReportName;

            ucReport.DisplayFilter      = false;
            ucReport.LoadFormParameters = false;

            string  parameterString = String.Format("AutomationProcessID;{0};", processId);
            DataRow parameters      = ReportHelper.GetReportParameters(report, parameterString, null, CultureHelper.EnglishCulture);
            ucReport.ReportParameters     = parameters;
            reportHeader.ReportParameters = parameters;

            reportHeader.ActionPerformed += reportHeader_ActionPerformed;
        }
    }
예제 #16
0
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        SetCulture();

        IFormatProvider culture        = DateTimeHelper.DefaultIFormatProvider;
        IFormatProvider currentCulture = new System.Globalization.CultureInfo(System.Threading.Thread.CurrentThread.CurrentUICulture.IetfLanguageTag);

        reportId = ValidationHelper.GetInteger(Request.QueryString["reportid"], 0);
        ReportInfo ri = ReportInfoProvider.GetReportInfo(reportId);

        if (ri != null)
        {
            string[] httpParameters = ValidationHelper.GetString(Request.QueryString["parameters"], "").Split(";".ToCharArray());

            FormInfo fi = new FormInfo(ri.ReportParameters);
            // Get datarow with required columns
            DataRow dr = fi.GetDataRow();

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

                // Put values to given data row
                for (int i = 0; i < httpParameters.Length; i = i + 2)
                {
                    if (dr.Table.Columns.Contains(httpParameters[i]))
                    {
                        if (dr.Table.Columns[httpParameters[i]].DataType != typeof(DateTime))
                        {
                            dr[httpParameters[i]] = httpParameters[i + 1];
                        }
                        else
                        {
                            if (httpParameters[i + 1] != String.Empty)
                            {
                                dr[httpParameters[i]] = Convert.ToDateTime(httpParameters[i + 1], culture).ToString(currentCulture);
                            }
                        }
                    }
                }

                dr.AcceptChanges();

                DisplayReport1.LoadFormParameters = false;
                DisplayReport1.ReportName         = ri.ReportName;
                DisplayReport1.DisplayFilter      = false;
                DisplayReport1.ReportParameters   = dr;
            }
            else
            {
                DisplayReport1.ReportName    = ri.ReportName;
                DisplayReport1.DisplayFilter = false;
            }
            this.Page.Title = GetString("Report_Print.lblPrintReport") + " " + ri.ReportDisplayName;
        }
    }
예제 #17
0
    /// <summary>
    /// Handles delete action.
    /// </summary>
    /// <param name="eventArgument">Objecttype(report or reportcategory);objectid</param>
    public void RaisePostBackEvent(string eventArgument)
    {
        string[] values = eventArgument.Split(';');
        if ((values != null) && (values.Length == 3))
        {
            int id                 = ValidationHelper.GetInteger(values[1], 0);
            int parentId           = ValidationHelper.GetInteger(values[2], 0);
            ReportCategoryInfo rci = ReportCategoryInfoProvider.GetReportCategoryInfo(parentId);

            //Test permission
            if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "Modify"))
            {
                String denyScript = @"var redirected = false;if (!redirected) {if ((window.parent != null) && (window.parent.frames['reportcategorytree'] != null)) {
                parent.frames['reportedit'].location = '" + ResolveUrl(AccessDeniedPage) + @"?resource=cms.reporting&permission=Modify';redirected = true;         
                }}";
                if (rci != null)
                {
                    denyScript = SelectAtferLoad(rci.CategoryPath + "/", id, values[0], parentId, false) + denyScript;
                }
                ltlScript.Text += ScriptHelper.GetScript(denyScript);
                return;
            }

            string script = String.Empty;

            switch (values[0])
            {
            case "report":
                ReportInfoProvider.DeleteReportInfo(id);
                break;

            case "reportcategory":
                try
                {
                    ReportCategoryInfoProvider.DeleteReportCategoryInfo(id);
                }
                catch (Exception ex)
                {
                    // Make alert with exception message, most probable cause is deleting category with subcategories
                    script = String.Format("alert('{0}');\n", ex.Message);

                    // Current node stays selected
                    parentId = id;
                }
                break;
            }

            // Select parent node after delete
            if (rci != null)
            {
                script          = SelectAtferLoad(rci.CategoryPath + "/", parentId, "reportcategory", rci.CategoryParentID, true) + script;
                ltlScript.Text += ScriptHelper.GetScript(script);
            }

            treeElem.ReloadData();
        }
    }
예제 #18
0
    /// <summary>
    /// Deletes report. Called when the "Delete report" button is pressed.
    /// Expects the CreateReport method to be run first.
    /// </summary>
    private bool DeleteReport()
    {
        // Get the report
        ReportInfo deleteReport = ReportInfoProvider.GetReportInfo("MyNewReport");

        // Delete the report
        ReportInfoProvider.DeleteReportInfo(deleteReport);

        return(deleteReport != null);
    }
예제 #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((!RequestHelper.IsPostBack()) && (QueryHelper.GetInteger("View", 0) == 1))
        {
            ltlScript.Text += ScriptHelper.GetScript("parent.frames['reportHeader'].SetSavedTab()");
        }

        // Initialize controls
        imgPrint.ImageUrl  = GetImageUrl("General/print.png");
        imgSendTo.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/send.png");

        mSendToEmail = GetString("SavedReport_View.SendToEmail");
        mPrint       = GetString("Report_View.Print");

        imgPrint.AlternateText  = mPrint;
        imgSendTo.AlternateText = mSendToEmail;

        // Creates SavedReport obj
        int             savedReportId = ValidationHelper.GetInteger(Request.QueryString["reportId"], 0);
        SavedReportInfo sri           = SavedReportInfoProvider.GetSavedReportInfo(savedReportId);

        if (sri != null)
        {
            ReportInfo ri = ReportInfoProvider.GetReportInfo(sri.SavedReportReportID);
            if (ri != null)
            {
                // Initialize pagetitle breadcrumbs
                string[,] pageTitleTabs = new string[2, 3];
                pageTitleTabs[0, 0]     = ri.ReportDisplayName;
                pageTitleTabs[0, 1]     = "~/CMSModules/Reporting/Tools/SavedReports/SavedReports_List.aspx?reportid=" + ri.ReportID.ToString();
                pageTitleTabs[0, 2]     = "";
                pageTitleTabs[1, 0]     = sri.SavedReportTitle;
                pageTitleTabs[1, 1]     = "";
                pageTitleTabs[1, 2]     = "";
                PageTitle.Breadcrumbs   = pageTitleTabs;
            }

            // Backward compatibility
            // Check whether url is relative and check whether url to get report graph page is correct
            string savedReportHtml = ReportInfoProvider.GetReportGraphUrlRegExp.Replace(sri.SavedReportHTML, RepairURL);
            ltlHtml.Text = HTMLHelper.ResolveUrls(savedReportHtml, ResolveUrl("~/"));
        }

        ltlModal.Text = ScriptHelper.GetScript("function myModalDialog(url, name, width, height) { " +
                                               "win = window; " +
                                               "var dHeight = height; var dWidth = width; " +
                                               "if (( document.all )&&(navigator.appName != 'Opera')) { " +
                                               "try { win = wopener.window; } catch (e) {} " +
                                               "if ( parseInt(navigator.appVersion.substr(22, 1)) < 7 ) { dWidth += 4; dHeight += 58; }; " +
                                               "dialog = win.showModalDialog(url, this, 'dialogWidth:' + dWidth + 'px;dialogHeight:' + dHeight + 'px;resizable:yes;scroll:yes'); " +
                                               "} else { " +
                                               "oWindow = win.open(url, name, 'height=' + dHeight + ',width=' + dWidth + ',toolbar=no,directories=no,menubar=no,modal=yes,dependent=yes,resizable=yes,scroll=yes,scrollbars=yes'); oWindow.opener = this; oWindow.focus(); } } ");

        this.btnPrint.OnClientClick = "myModalDialog('SavedReport_Print.aspx?reportid=" + savedReportId.ToString() + "', 'SavedReportPrint', 650, 700); return false;";
    }
예제 #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Handle site selectors visibility
        if (IsSiteManager)
        {
            CurrentMaster.DisplaySiteSelectorPanel = true;
            siteOrGlobalSelector.Visible           = false;
            siteId = siteSelector.SiteID;
        }
        else
        {
            // Init site filter when user is authorized for global and site contacts
            if (AuthorizedForGlobalContacts && AuthorizedForSiteContacts)
            {
                CurrentMaster.DisplaySiteSelectorPanel = true;
                siteSelector.Visible = false;
                siteId = ValidationHelper.GetInteger(siteOrGlobalSelector.Value, SiteContext.CurrentSiteID);
            }
            else if (AuthorizedForSiteContacts)
            {
                // User is authorized only for site contacts so set current site id
                siteId = SiteID;
            }
            else if (AuthorizedForGlobalContacts)
            {
                // User can read only global contacts
                siteId = UniSelector.US_GLOBAL_RECORD;
            }
            else
            {
                // User has no permissions
                RedirectToAccessDenied(ModuleName.CONTACTMANAGEMENT, "ReadContacts");
            }
        }

        // Set report parameters
        ReportInfo report = ReportInfoProvider.GetReportInfo("Number_of_contacts_in_steps");

        if (report != null)
        {
            ucReport.ReportName     = report.ReportName;
            reportHeader.ReportName = report.ReportName;

            ucReport.DisplayFilter      = false;
            ucReport.LoadFormParameters = false;

            string  parameterString = String.Format("AutomationProcessID;{0};SiteID;{1}", processId, siteId);
            DataRow parameters      = ReportHelper.GetReportParameters(report, parameterString, null, CultureHelper.EnglishCulture, CultureHelper.PreferredUICultureInfo);
            ucReport.ReportParameters     = parameters;
            reportHeader.ReportParameters = parameters;

            reportHeader.ActionPerformed += reportHeader_ActionPerformed;
        }
    }
예제 #21
0
    /// <summary>
    /// Returns report graph.
    /// </summary>
    private void GetReportGraph(ReportGraphInfo reportGraph)
    {
        // Check whether report graph is defined
        if (reportGraph == null)
        {
            return;
        }

        report = ReportInfoProvider.GetReportInfo(reportGraph.GraphReportID);
        if (report == null)
        {
            return;
        }

        // Check graph security settings
        if (!(CheckReportAccess(report) && CheckEmailModeSubscription(report, ValidationHelper.GetBoolean(ReportGraphInfo.GraphSettings["SubscriptionEnabled"], true))))
        {
            Visible = false;
            return;
        }

        // Prepare query attributes
        QueryText = reportGraph.GraphQuery;
        QueryIsStoredProcedure = reportGraph.GraphQueryIsStoredProcedure;

        // Init parameters
        InitParameters(report.ReportParameters);

        // Init macro resolver
        InitResolver();

        // Indicaates whether exception was throw during data loading
        errorOccurred = false;

        // Create graph data
        try
        {
            // Load data
            DataSource = LoadData();
        }
        catch (Exception ex)
        {
            EventLogProvider.LogException("Get report graph", "E", ex);
            lblError.Text    = ex.Message;
            lblError.Visible = true;
            errorOccurred    = true;
        }

        if (DataHelper.DataSourceIsEmpty(DataSource) && EmailMode && SendOnlyNonEmptyDataSource)
        {
            Visible = false;
            return;
        }
    }
    /// <summary>
    /// OnInit.
    /// </summary>
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        // Ensure the script manager
        EnsureScriptManager();

        reportId = ValidationHelper.GetInteger(Request.QueryString["ReportId"], 0);
        ReportInfo ri = ReportInfoProvider.GetReportInfo(reportId);

        if (ri != null)
        {
            DisplayReport1.ReportName = ri.ReportName;
        }
    }
예제 #23
0
    /// <summary>
    /// OnInit override.
    /// </summary>
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        // Ensure the script manager
        EnsureScriptManager();

        reportId = QueryHelper.GetInteger("ReportId", 0);
        ReportInfo ri = ReportInfoProvider.GetReportInfo(reportId);

        if (ri != null)
        {
            displayReport.ReportName = ri.ReportName;
        }
    }
예제 #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var savedReportId = QueryHelper.GetInteger("reportId", 0);

        if ((!RequestHelper.IsPostBack()) && (QueryHelper.GetInteger("View", 0) == 1))
        {
            ltlScript.Text += ScriptHelper.GetScript("parent.SelTab(3,'','');");
        }

        string queryParams = String.Format("?reportid={0}", savedReportId);

        HeaderActions.AddAction(new HeaderAction
        {
            Text          = GetString("Report_View.Print"),
            OnClientClick = string.Format("myModalDialog('SavedReport_Print.aspx{0}&hash={1}', 'SavedReportPrint', 650, 700); return false;", queryParams, QueryHelper.GetHash(queryParams))
        });

        // Creates SavedReport obj
        SavedReportInfo sri = SavedReportInfoProvider.GetSavedReportInfo(savedReportId);

        if (sri != null)
        {
            ReportInfo ri = ReportInfoProvider.GetReportInfo(sri.SavedReportReportID);
            if (ri != null)
            {
                // Initialize pagetitle breadcrumbs
                PageBreadcrumbs.Items.Add(new BreadcrumbItem()
                {
                    Text        = ri.ReportDisplayName,
                    RedirectUrl = URLHelper.AddParameterToUrl(UIContextHelper.GetElementUrl(ModuleName.REPORTING, "SavedReports", false, ri.ReportID), "reportid", ri.ReportID.ToString())
                });

                PageBreadcrumbs.Items.Add(new BreadcrumbItem()
                {
                    Text = sri.SavedReportTitle
                });
            }

            // Backward compatibility
            // Check whether url is relative and check whether url to get report graph page is correct
            string savedReportHtml = ReportInfoProvider.GetReportGraphUrlRegExp.Replace(sri.SavedReportHTML, RepairURL);
            ltlHtml.Text = HTMLHelper.ResolveUrls(savedReportHtml, ResolveUrl("~/"));
        }

        ScriptHelper.RegisterPrintDialogScript(this);
    }
예제 #25
0
    protected override void OnPreRender(EventArgs e)
    {
        //apply reportid condition if report was selected wia uniselector
        string     reportName = ValidationHelper.GetString(usReports.Value, String.Empty);
        ReportInfo ri         = ReportInfoProvider.GetReportInfo(reportName);

        if (ri != null)
        {
            FormInfo fi = new FormInfo(ri.ReportParameters);
            DataRow  dr = fi.GetDataRow();
            DataSet  ds = this.CurrentDataSet;

            this.ViewState["ParametersXmlData"]   = null;
            this.ViewState["ParametersXmlSchema"] = null;

            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                this.ViewState["ParametersXmlData"]   = ds.GetXml();
                this.ViewState["ParametersXmlSchema"] = ds.GetXmlSchema();
            }

            if (!keepDataInWindowsHelper)
            {
                WindowHelper.Remove(CurrentGuid().ToString());
            }

            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                ds = DataHelper.DataSetPivot(ds, new string[] { "ParameterName", "ParameterValue" });
                ugParameters.DataSource = ds;
                ugParameters.ReloadData();
                pnlParameters.Visible = true;
            }
            else
            {
                pnlParameters.Visible = false;
            }
        }
        else
        {
            pnlParameters.Visible = false;
        }

        base.OnPreRender(e);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((!RequestHelper.IsPostBack()) && (QueryHelper.GetInteger("View", 0) == 1))
        {
            ltlScript.Text += ScriptHelper.GetScript("parent.frames['reportHeader'].SetSavedTab()");
        }

        // Initialize controls
        imgPrint.ImageUrl  = GetImageUrl("General/print.png");
        imgSendTo.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/send.png");

        mSendToEmail = GetString("SavedReport_View.SendToEmail");
        mPrint       = GetString("Report_View.Print");

        imgPrint.AlternateText  = mPrint;
        imgSendTo.AlternateText = mSendToEmail;

        // Creates SavedReport obj
        int             savedReportId = ValidationHelper.GetInteger(Request.QueryString["reportId"], 0);
        SavedReportInfo sri           = SavedReportInfoProvider.GetSavedReportInfo(savedReportId);

        if (sri != null)
        {
            ReportInfo ri = ReportInfoProvider.GetReportInfo(sri.SavedReportReportID);
            if (ri != null)
            {
                // Initialize pagetitle breadcrumbs
                string[,] pageTitleTabs = new string[2, 3];
                pageTitleTabs[0, 0]     = ri.ReportDisplayName;
                pageTitleTabs[0, 1]     = "~/CMSModules/Reporting/Tools/SavedReports/SavedReports_List.aspx?reportid=" + ri.ReportID.ToString();
                pageTitleTabs[0, 2]     = string.Empty;
                pageTitleTabs[1, 0]     = sri.SavedReportTitle;
                pageTitleTabs[1, 1]     = string.Empty;
                pageTitleTabs[1, 2]     = string.Empty;
                PageTitle.Breadcrumbs   = pageTitleTabs;
            }

            // Backward compatibility
            // Check whether url is relative and check whether url to get report graph page is correct
            string savedReportHtml = ReportInfoProvider.GetReportGraphUrlRegExp.Replace(sri.SavedReportHTML, RepairURL);
            ltlHtml.Text = HTMLHelper.ResolveUrls(savedReportHtml, ResolveUrl("~/"));
        }
        ScriptHelper.RegisterPrintDialogScript(this);
        btnPrint.OnClientClick = "myModalDialog('SavedReport_Print.aspx?reportid=" + savedReportId.ToString() + "', 'SavedReportPrint', 650, 700); return false;";
    }
    private bool IsConversionReport(string reportName)
    {
        var report = ReportInfoProvider.GetReportInfo(reportName);

        if (report != null)
        {
            var category = ReportCategoryInfoProvider.GetReportCategoryInfo(report.ReportCategoryID);
            if (category != null)
            {
                if (!category.CategoryPath.StartsWith("/WebAnalytics/Conversion", StringComparison.OrdinalIgnoreCase))
                {
                    return(false);
                }
            }
        }

        return(true);
    }
    private bool IsBannerManagementReport(string reportCodeName)
    {
        var report = ReportInfoProvider.GetReportInfo(reportCodeName);

        if (report != null)
        {
            var category = ReportCategoryInfoProvider.GetReportCategoryInfo(report.ReportCategoryID);
            if (category != null)
            {
                if (!category.CategoryPath.StartsWith("/BannerManagement", StringComparison.OrdinalIgnoreCase))
                {
                    return(false);
                }
            }
        }

        return(true);
    }
예제 #29
0
    /// <summary>
    /// Gets and updates report. Called when the "Get and update report" button is pressed.
    /// Expects the CreateReport method to be run first.
    /// </summary>
    private bool GetAndUpdateReport()
    {
        // Get the report
        ReportInfo updateReport = ReportInfoProvider.GetReportInfo("MyNewReport");

        if (updateReport != null)
        {
            // Update the properties
            updateReport.ReportDisplayName = updateReport.ReportDisplayName.ToLower();

            // Save the changes
            ReportInfoProvider.SetReportInfo(updateReport);

            return(true);
        }

        return(false);
    }
    private void editor_OnAfterDefinitionUpdate(object sender, EventArgs e)
    {
        // Check 'Modify' permission
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "Modify"))
        {
            RedirectToAccessDenied("cms.reporting", "Modify");
        }

        ReportInfo ri = ReportInfoProvider.GetReportInfo(reportId);

        if (ri != null)
        {
            // Get new report parameters changed by fieldeditor
            ri.ReportParameters = editor.FormDefinition;

            // Update report parameters in database
            ReportInfoProvider.SetReportInfo(ri);
        }
    }