Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (UserInfo.IsSuperUser && Directory.Exists(Server.MapPath("App_Code/Reports")))
            {
                Skin.AddModuleMessage(this, Localization.GetString("CleanUpOldAppCode.Text", LocalResourceFile),
                                      ModuleMessage.ModuleMessageType.YellowWarning);
            }

            Report                    = ReportsController.GetReport(ModuleConfiguration);
            InfoPane.Visible          = Report.ShowInfoPane;
            ControlsPane.Visible      = Report.ShowControls;
            ExportExcelButton.Visible = Report.ExportExcel;


            if (Report.ShowInfoPane)
            {
                TitleLiteral.Text       = Report.Title;
                DescriptionLiteral.Text = Report.Description;
            }

            if (Report.AutoRunReport)
            {
                RunReport();
            }
        }
Пример #2
0
 private bool AutoExecuteReport(VisualizerControlBase ctlVisualizer, ReportInfo report, ref DataTable results,
                                bool fromCache)
 {
     try
     {
         results = ReportsController.ExecuteReport(
             report, string.Concat(ReportsConstants.CACHEKEY_Reports, Convert.ToString(ModuleId)),
             report.CacheDuration <= 0, this, ref fromCache);
     }
     catch (DataSourceException ex)
     {
         // Display the error message to host users only
         if (UserInfo.IsSuperUser)
         {
             Skin.AddModuleMessage(this,
                                   string.Format(Localization.GetString("HostExecuteError.Message",
                                                                        LocalResourceFile),
                                                 ex.LocalizedMessage),
                                   ModuleMessage.ModuleMessageType.RedError);
         }
         else if (IsEditable)
         {
             Skin.AddModuleMessage(this,
                                   Localization.GetString("AdminExecuteError.Message",
                                                          LocalResourceFile),
                                   ModuleMessage.ModuleMessageType.RedError);
         }
         Services.Exceptions.Exceptions.LogException(ex);
         ctlVisualizer.Visible = false;
         return(false);
     }
     return(true);
 }
Пример #3
0
        protected void ExportExcelButton_Click(object sender, EventArgs e)
        {
            DataTable results = null;

            results = ReportsController.ExecuteReport(Report, String.Concat(ReportsConstants.CACHEKEY_Reports, ModuleId), true, this);
            Session["report_export"] = results;
            Response.Redirect("~/desktopmodules/reports/excel.aspx");
        }
Пример #4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///     UpdateSettings saves the modified settings to the Database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void UpdateSettings()
        {
            // Do not update report definition if the user is not a SuperUser
            if (UserInfo.IsSuperUser)
            {
                // Update the settings
                UpdateDataSourceSettings();

                // Save the report definition
                ReportsController.UpdateReportDefinition(ModuleId, Report);
            }

            // Non-SuperUsers can change TabModuleSettings (display settings)

            // Update cache duration (0 => no caching)
            var duration = 0;

            if (chkCaching.Checked)
            {
                duration = int.Parse(txtCacheDuration.Text);
            }

            Report.CacheDuration = duration;
            Report.ShowInfoPane  = chkShowInfoPane.Checked;
            Report.ShowControls  = chkShowControls.Checked;
            Report.AutoRunReport = chkAutoRunReport.Checked;
            Report.ExportExcel   = chkExportExcel.Checked;
            Report.TokenReplace  = chkTokenReplace.Checked;

            // and Visualizer Settings
            Report.Visualizer = VisualizerDropDown.SelectedValue;
            Report.VisualizerSettings.Clear();
            var settings = GetSettingsControlFromView(VisualizerSettings.GetActiveView());

            if (settings != null)
            {
                settings.SaveSettings(Report.VisualizerSettings);
            }

            // Save the report view and clear the cache
            ReportsController.UpdateReportView(TabModuleId, Report);

            // refresh cache
            ModuleController.SynchronizeModule(ModuleId);
            ReportsController.ClearCachedResults(ModuleId);
        }
Пример #5
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///     LoadSettings loads the settings from the Database and displays them
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void LoadSettings()
        {
            if (!this.Page.IsPostBack)
            {
                this.Report = ReportsController.GetReport(this.ModuleConfiguration);
                if (ReferenceEquals(this.Report, null))
                {
                    this.Report = new ReportInfo();
                }

                // If the user has permission to see the Data Source Settings
                if (this.CheckPermissions())
                {
                    // Load the fields
                    this.txtTitle.Text       = this.Report.Title;
                    this.txtDescription.Text = this.Report.Description;
                    this.txtParameters.Text  = this.Report.Parameters;

                    // Load the Data Source Settings
                    var temp_extensionName = this.Report.DataSource;
                    this.LoadExtensionSettings("DataSource", ref temp_extensionName, "DataSourceName.Text",
                                               "DataSource.Text", DEFAULT_DataSource, this.DataSourceDropDown,
                                               this.DataSourceSettings, this.DataSourceNotConfiguredView,
                                               this.Report.DataSourceSettings, FILENAME_RESX_DataSource, true);
                    this.Report.DataSource = temp_extensionName;

                    // Load the filtering settings
                    var encodeBuilder = new StringBuilder();
                    var decodeBuilder = new StringBuilder();
                    foreach (List <ConverterInstanceInfo> list in this.Report.Converters.Values)
                    {
                        foreach (var Converter in list)
                        {
                            StringBuilder builder = null;
                            if ("HtmlEncode".Equals(Converter.ConverterName))
                            {
                                builder = encodeBuilder;
                            }
                            else if ("HtmlDecode".Equals(Converter.ConverterName))
                            {
                                builder = decodeBuilder;
                            }

                            if (builder != null)
                            {
                                if (builder.Length > 0)
                                {
                                    builder.Append(",");
                                }
                                builder.Append(Converter.FieldName);
                            }
                        }
                    }
                    this.txtHtmlEncode.Text = encodeBuilder.ToString();
                    this.txtHtmlDecode.Text = decodeBuilder.ToString();
                }

                this.txtCacheDuration.Text    = this.Report.CacheDuration.ToString();
                this.chkShowInfoPane.Checked  = this.Report.ShowInfoPane;
                this.chkShowControls.Checked  = this.Report.ShowControls;
                this.chkAutoRunReport.Checked = this.Report.AutoRunReport;
                this.chkTokenReplace.Checked  = this.Report.TokenReplace;

                // Set the caching checkbox
                if (this.Report.CacheDuration <= 0)
                {
                    this.chkCaching.Checked   = false;
                    this.Report.CacheDuration = 0;
                }
                else
                {
                    this.chkCaching.Checked = true;
                }

                // Update the cache duration text box visibility
                this.UpdateCachingSpan();

                // Load Visualizer Settings
                var temp_extensionName2 = this.Report.Visualizer;
                this.LoadExtensionSettings("Visualizer", ref temp_extensionName2, "VisualizerName.Text",
                                           "Visualizer.Text", DEFAULT_Visualizer, this.VisualizerDropDown,
                                           this.VisualizerSettings, null, this.Report.VisualizerSettings,
                                           FILENAME_RESX_Visualizer, false);
                this.Report.Visualizer = temp_extensionName2;
            }
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.UserInfo.IsSuperUser && Directory.Exists(this.Server.MapPath("App_Code/Reports")))
            {
                Skin.AddModuleMessage(this, Localization.GetString("CleanUpOldAppCode.Text", this.LocalResourceFile),
                                      ModuleMessage.ModuleMessageType.YellowWarning);
            }

            this.Report               = ReportsController.GetReport(this.ModuleConfiguration);
            this.InfoPane.Visible     = this.Report.ShowInfoPane;
            this.ControlsPane.Visible = this.Report.ShowControls;

            if (this.Report.ShowInfoPane)
            {
                this.TitleLiteral.Text       = this.Report.Title;
                this.DescriptionLiteral.Text = this.Report.Description;
            }

            if (this.Report.AutoRunReport)
            {
                this.RunReport();
            }
            //durthaler added code
            if (!IsPostBack)
            {
                txtStartDate.Text  = DateTime.Now.AddDays(-7).ToShortDateString();
                txtEndingDate.Text = DateTime.Now.ToShortDateString();
                LoadUsers();
            }
            ModuleController mc      = new ModuleController();
            string           sqlUser = "";

            if (ddlUserName.SelectedIndex > 0)
            {
                sqlUser = "******" + "'" + ddlUserName.SelectedItem.Text + "'";
            }

            string sqlSelect = @"
					SELECT 
						USER_NAME AS [Sales Rep]
						, COUNT(1)  AS [Search Count]

					FROM [dbo].[vw_UserSearches] 
				"                ;

            string sqlWhere = @"
					WHERE insertedon BETWEEN "                     + "'" + txtStartDate.Text + "'"
                              + " AND " + "'" + txtEndingDate.Text + "'" + " AND USER_ID > 2 ";

            string sqlGroupBy = @"
					GROUP BY 
						USER_NAME

				ORDER BY
						USER_NAME

				"                ;

            string sqlResult = sqlSelect + sqlWhere + sqlUser + sqlGroupBy;

            mc.UpdateModuleSetting(ModuleId, "dnn_ReportsDS_DotNetNuke_Query", sqlResult);
            //end durthaler added code
        }