public override void LoadSettings(Dictionary <string, string> VisualizerSettings)
        {
            chkPageData.Checked =
                Convert.ToBoolean(
                    SettingsUtil.GetDictionarySetting(VisualizerSettings, ReportsConstants.SETTING_Grid_EnablePaging,
                                                      false));
            chkSortData.Checked =
                Convert.ToBoolean(
                    SettingsUtil.GetDictionarySetting(VisualizerSettings, ReportsConstants.SETTING_Grid_EnableSorting,
                                                      false));
            txtPageSize.Text =
                Convert.ToString(
                    SettingsUtil.GetDictionarySetting(VisualizerSettings, ReportsConstants.SETTING_Grid_PageSize,
                                                      "10"));
            chkShowHeader.Checked =
                Convert.ToBoolean(
                    SettingsUtil.GetDictionarySetting(VisualizerSettings, ReportsConstants.SETTING_Grid_ShowHeader,
                                                      true));
            txtAdditionalCSS.Text =
                Convert.ToString(
                    SettingsUtil.GetDictionarySetting(VisualizerSettings, ReportsConstants.SETTING_Grid_AdditionalCSS,
                                                      ""));
            txtCSSClass.Text =
                Convert.ToString(
                    SettingsUtil.GetDictionarySetting(VisualizerSettings, ReportsConstants.SETTING_Grid_CSSClass, ""));
            var gridLines = Convert.ToString(Utilities.GetGridLinesSetting(VisualizerSettings).ToString());

            DropDownUtils.TrySetValue(ddlGridLines, Convert.ToString(
                                          SettingsUtil.GetDictionarySetting(
                                              VisualizerSettings,
                                              ReportsConstants.SETTING_Grid_GridLines,
                                              ReportsConstants.DEFAULT_Grid_GridLines)),
                                      ReportsConstants.DEFAULT_Grid_GridLines);
            UpdatePageSizeText();
        }
Exemple #2
0
        public override void LoadSettings(Dictionary <string, string> Settings)
        {
            var useConnectionString =
                Convert.ToBoolean(
                    SettingsUtil.GetDictionarySetting(Settings, ReportsConstants.SETTING_UseConnectionString, false));

            this.AutomaticConnStrRadio.Checked = !useConnectionString;
            this.ManualConnStrRadio.Checked    = useConnectionString;
            this.ConnStrTextBox.Text           =
                Convert.ToString(
                    SettingsUtil.GetDictionarySetting(Settings, ReportsConstants.SETTING_ConnectionString,
                                                      string.Empty));
            this.ServerTextBox.Text =
                Convert.ToString(
                    SettingsUtil.GetDictionarySetting(Settings, ReportsConstants.SETTING_Server, string.Empty));
            this.DatabaseTextBox.Text =
                Convert.ToString(
                    SettingsUtil.GetDictionarySetting(Settings, ReportsConstants.SETTING_Database, string.Empty));
            this.IntegratedSecurityCheckBox.Checked =
                Convert.ToBoolean(
                    SettingsUtil.GetDictionarySetting(Settings, ReportsConstants.SETTING_Sql_UseIntegratedSecurity,
                                                      false));
            if (!this.IntegratedSecurityCheckBox.Checked)
            {
                this.UserNameTextBox.Text =
                    Convert.ToString(
                        SettingsUtil.GetDictionarySetting(Settings, ReportsConstants.SETTING_UserName, string.Empty));
                this.PasswordTextBox.Text =
                    Convert.ToString(
                        SettingsUtil.GetDictionarySetting(Settings, ReportsConstants.SETTING_Password, string.Empty));
            }
            this.SqlDataSourceCommonSettingsControl.LoadSettings(Settings);

            this.UpdateControlVisibility();
        }
Exemple #3
0
 public override void LoadSettings(Dictionary <string, string> VisualizerSettings)
 {
     this.ctlTemplate.Url =
         Convert.ToString(SettingsUtil.GetDictionarySetting(VisualizerSettings,
                                                            ReportsConstants.SETTING_Html_TemplateFile,
                                                            Null.NullString));
     this.ctlTemplate.DataBind();
 }
        protected override DbParameter CreateParameter(string name, object value)
        {
            var factory     = this.GetProviderFactory();
            var paramPrefix =
                Convert.ToString(SettingsUtil.GetDictionarySetting(this.CurrentReport.DataSourceSettings,
                                                                   ReportsConstants.SETTING_ADO_ParamPrefix,
                                                                   string.Empty));
            var param = factory.CreateParameter();

            param.ParameterName = string.Concat(paramPrefix, name);
            param.Value         = value;
            return(param);
        }
Exemple #5
0
        public override void LoadSettings(Dictionary <string, string> VisualizerSettings)
        {
            this.ctlTransform.Url =
                Convert.ToString(SettingsUtil.GetDictionarySetting(VisualizerSettings,
                                                                   ReportsController.SETTING_Xslt_TransformFile,
                                                                   string.Empty));
            this.ctlTransform.DataBind();

            if (this.ParentModule.UserInfo.IsSuperUser)
            {
                this.StoredExtensionObjects = ReportsController.GetXsltExtensionObjects(this.TabModuleId);
            }
        }
        public override void DataBind()
        {
            // Get the report for this module
            if (!ValidateDataSource() || !ValidateResults())
            {
                pnlContent.Visible = false;
            }
            else
            {
                pnlContent.Visible = true;
                var sFileID =
                    Convert.ToString(SettingsUtil.GetDictionarySetting(Report.VisualizerSettings,
                                                                       ReportsConstants.SETTING_Html_TemplateFile,
                                                                       string.Empty));
                if (!string.IsNullOrEmpty(sFileID))
                {
                    var sFile = Utilities.MapFileIdPath(ParentModule.PortalSettings, sFileID);
                    if (!string.IsNullOrEmpty(sFile))
                    {
                        var sHtml = File.ReadAllText(sFile);
                        if (!string.IsNullOrEmpty(sHtml))
                        {
                            // Iterate over each row
                            foreach (DataRow row in ReportResults.Rows)
                            {
                                var rowHtml = sHtml;
                                foreach (DataColumn dcol in ReportResults.Columns)
                                {
                                    rowHtml = rowHtml.Replace(string.Format("[{0}]", dcol.ColumnName),
                                                              Convert.ToString(row[dcol].ToString()));
                                }

                                var objSec     = new PortalSecurity();
                                var divContent = new HtmlGenericControl("div");
                                divContent.Attributes["class"] = "DNN_Reports_HTML_Item";
                                divContent.InnerHtml           =
                                    objSec.InputFilter(rowHtml, PortalSecurity.FilterFlag.NoScripting); //     .MultiLine|PortalSecurity.FilterFlag.NoSQL
                                pnlContent.Controls.Add(divContent);
                            }
                        }
                        base.DataBind();
                    }
                }
            }
        }
Exemple #7
0
        private void ConfigureGridFromSettings()
        {
            // Load Paging and Sorting data from Visualizer Settings
            this.grdResults.AllowPaging =
                Convert.ToBoolean(SettingsUtil.GetDictionarySetting(this.Report.VisualizerSettings,
                                                                    ReportsConstants.SETTING_Grid_EnablePaging,
                                                                    false));
            this.grdResults.AllowSorting =
                Convert.ToBoolean(SettingsUtil.GetDictionarySetting(this.Report.VisualizerSettings,
                                                                    ReportsConstants.SETTING_Grid_EnableSorting,
                                                                    false));
            this.grdResults.PageSize =
                Convert.ToInt32(SettingsUtil.GetDictionarySetting(this.Report.VisualizerSettings,
                                                                  ReportsConstants.SETTING_Grid_PageSize, 10));
            this.grdResults.ShowHeader =
                Convert.ToBoolean(SettingsUtil.GetDictionarySetting(this.Report.VisualizerSettings,
                                                                    ReportsConstants.SETTING_Grid_ShowHeader, true));
            this.grdResults.CssClass +=
                Convert.ToString(SettingsUtil.GetDictionarySetting(this.Report.VisualizerSettings,
                                                                   ReportsConstants.SETTING_Grid_CSSClass, ""));

            var styleString =
                Convert.ToString(SettingsUtil.GetDictionarySetting(this.Report.VisualizerSettings,
                                                                   ReportsConstants.SETTING_Grid_AdditionalCSS, ""));

            foreach (var styleEntry in styleString.Split(';'))
            {
                var styleArray = styleEntry.Split(':');
                if (styleArray.Length != 2)
                {
                    continue;
                }
                this.grdResults.Style.Add(styleArray[0], styleArray[1]);
            }

            this.grdResults.GridLines = Utilities.GetGridLinesSetting(this.Report.VisualizerSettings);
        }
        public override void LoadSettings(Dictionary <string, string> Settings)
        {
            this.ConnStrTextBox.Text =
                Convert.ToString(
                    SettingsUtil.GetDictionarySetting(Settings, ReportsController.SETTING_ConnectionString,
                                                      string.Empty));
            this.ParamPrefixTextBox.Text =
                Convert.ToString(
                    SettingsUtil.GetDictionarySetting(Settings, ReportsController.SETTING_ADO_ParamPrefix,
                                                      string.Empty));

            var provider =
                Convert.ToString(
                    SettingsUtil.GetDictionarySetting(Settings, ReportsController.SETTING_ADO_ProviderName,
                                                      string.Empty));

            this.EnsureProviderDropDown();
            if (this.ProviderNameDropDown.Items.FindByValue(provider) != null)
            {
                this.ProviderNameDropDown.SelectedValue = provider;
            }

            this.SqlDataSourceCommonSettingsControl.LoadSettings(Settings);
        }
Exemple #9
0
        public override void DataBind()
        {
            // Get the report for this module
            if (!this.ValidateDataSource() || !this.ValidateResults())
            {
                this.litContent.Visible = false;
            }
            else
            {
                this.litContent.Visible = true;

                // Get the extension objects
                IEnumerable <ExtensionObjectInfo> extensionObjects =
                    ReportsController.GetXsltExtensionObjects(this.TabModuleId);
                var argList = new XsltArgumentList();
                foreach (var extensionObject in extensionObjects)
                {
                    object obj = this.CreateExtensionObject(extensionObject.ClrType);
                    if (obj != null)
                    {
                        argList.AddExtensionObject(extensionObject.XmlNamespace, obj);
                    }
                }

                // Get the Xslt Url
                var sXsl = SettingsUtil.GetDictionarySetting(this.Report.VisualizerSettings,
                                                             ReportsConstants.SETTING_Xslt_TransformFile,
                                                             string.Empty);
                if (string.IsNullOrEmpty(sXsl))
                {
                    return;
                }
                if (sXsl.ToLower().StartsWith("fileid="))
                {
                    sXsl = Utilities.MapFileIdPath(this.ParentModule.PortalSettings, sXsl);
                }
                else if (!sXsl.ToLower().StartsWith("http"))
                {
                    sXsl = Path.Combine(this.ParentModule.PortalSettings.HomeDirectoryMapPath, sXsl.Replace("/", "\\"));
                }
                if (string.IsNullOrEmpty(sXsl))
                {
                    return;
                }

                // Serialize the results to Xml
                var sbSource = new StringBuilder();
                using (var srcWriter = new StringWriter(sbSource))
                {
                    this.ReportResults.WriteXml(srcWriter);
                }


                // Load the Transform and transform the Xml
                var sbDest = new StringBuilder();
                var xform  = new XslCompiledTransform();
                using (var destWriter = new XmlTextWriter(new StringWriter(sbDest)))
                {
                    xform.Load(sXsl);
                    xform.Transform(new XPathDocument(new StringReader(sbSource.ToString())), argList, destWriter);
                }


                var objSec = new PortalSecurity();
                this.litContent.Text = objSec.InputFilter(sbDest.ToString(), PortalSecurity.FilterFlag.NoScripting);
            }
            base.DataBind();
        }
Exemple #10
0
        protected override string CreateConnectionString()
        {
            var connStr = base.CreateConnectionString();

            if (!string.IsNullOrEmpty(connStr))
            {
                return(connStr);
            }

            // No connection string setting, we need to build it

            // First validate the fields
            var server = Convert.ToString(
                SettingsUtil.GetDictionarySetting(this.CurrentReport.DataSourceSettings,
                                                  ReportsConstants.SETTING_Server,
                                                  string.Empty));
            var database = Convert.ToString(
                SettingsUtil.GetDictionarySetting(this.CurrentReport.DataSourceSettings,
                                                  ReportsConstants.SETTING_Database,
                                                  string.Empty));
            var useIntegratedSecurity = Convert.ToBoolean(
                SettingsUtil.GetDictionarySetting(this.CurrentReport.DataSourceSettings,
                                                  ReportsConstants.SETTING_Sql_UseIntegratedSecurity,
                                                  false));
            var userName = Convert.ToString(
                SettingsUtil.GetDictionarySetting(this.CurrentReport.DataSourceSettings,
                                                  ReportsConstants.SETTING_UserName,
                                                  string.Empty));
            var password = Convert.ToString(
                SettingsUtil.GetDictionarySetting(this.CurrentReport.DataSourceSettings,
                                                  ReportsConstants.SETTING_Password,
                                                  string.Empty));

            var csBuilder = new SqlConnectionStringBuilder();

            if (!string.IsNullOrEmpty(server))
            {
                csBuilder.Add("Server", server);
            }
            if (!string.IsNullOrEmpty(database))
            {
                csBuilder.Add("Database", database);
            }
            if (!useIntegratedSecurity)
            {
                if (!string.IsNullOrEmpty(userName))
                {
                    csBuilder.Add("User ID", userName);
                }
                if (!string.IsNullOrEmpty(password))
                {
                    csBuilder.Add("Password", password);
                }
                csBuilder.Add("Trusted_Connection", "False");
            }
            else
            {
                csBuilder.Add("Trusted_Connection", "True");
            }

            return(csBuilder.ConnectionString);
        }
Exemple #11
0
 public override void LoadSettings(Dictionary <string, string> Settings)
 {
     this.QueryTextBox.Text =
         Convert.ToString(
             SettingsUtil.GetDictionarySetting(Settings, ReportsConstants.SETTING_Query, Null.NullString));
 }