private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                rdl = new RdlDocument();
                if (!IsPostBack)
                {
                    Page.DataBind();
                    gID = Sql.ToGuid(Request["ID"]);
                    if (!Sql.IsEmptyGuid(gID))
                    {
                        DbProviderFactory dbf = DbProviderFactories.GetFactory();
                        using (IDbConnection con = dbf.CreateConnection())
                        {
                            string sSQL;
                            sSQL = "select *             " + ControlChars.CrLf
                                   + "  from vwREPORTS_Edit" + ControlChars.CrLf
                                   + " where ID = @ID      " + ControlChars.CrLf;
                            using (IDbCommand cmd = con.CreateCommand())
                            {
                                cmd.CommandText = sSQL;
                                Sql.AddParameter(cmd, "@ID", gID);
                                con.Open();

                                using (IDataReader rdr = cmd.ExecuteReader(CommandBehavior.SingleRow))
                                {
                                    if (rdr.Read())
                                    {
                                        ctlModuleHeader.Title = Sql.ToString(rdr["NAME"]);
                                        SetPageTitle(L10n.Term(".moduleList.Reports") + " - " + ctlModuleHeader.Title);
                                        ViewState["ctlModuleHeader.Title"] = ctlModuleHeader.Title;

                                        string sXML = Sql.ToString(rdr["RDL"]);
                                        try
                                        {
                                            if (!Sql.IsEmptyString(sXML))
                                            {
                                                rdl.LoadRdl(Sql.ToString(rdr["RDL"]));
                                                ctlReportView.RunReport(rdl.OuterXml);
                                            }
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                lblError.Text = ex.Message;
            }
        }
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            try
            {
                if ( e.CommandName == "Import" )
                {
                    reqNAME.Enabled = true;
                    reqNAME.Validate();
                    reqFILENAME.Enabled = true;
                    reqFILENAME.Validate();
                    if ( Page.IsValid )
                    {
                        HttpPostedFile pstIMPORT = fileIMPORT.PostedFile;
                        if ( pstIMPORT != null )
                        {
                            if ( pstIMPORT.FileName.Length > 0 )
                            {
                                string sFILENAME       = Path.GetFileName (pstIMPORT.FileName);
                                string sFILE_EXT       = Path.GetExtension(sFILENAME);
                                string sFILE_MIME_TYPE = pstIMPORT.ContentType;

                                RdlDocument rdl = new RdlDocument();
                                rdl.Load(pstIMPORT.InputStream);
                                rdl.SetSingleNodeAttribute(rdl.DocumentElement, "Name", txtNAME.Text);
                                // 10/22/2007 Paul.  Use the Assigned User ID field when saving the record.
                                Guid gID = Guid.Empty;
                                SqlProcs.spREPORTS_Update(ref gID, Sql.ToGuid(txtASSIGNED_USER_ID.Value), txtNAME.Text, lstMODULE.SelectedValue, lstREPORT_TYPE.SelectedValue, rdl.OuterXml);
                            }
                        }
                        Response.Redirect("default.aspx");
                    }
                }
                else if ( e.CommandName == "Cancel" )
                {
                    Response.Redirect("default.aspx");
                }
            }
            catch(Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                ctlImportButtons.ErrorText = ex.Message;
            }
        }
Example #3
0
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Import")
                {
                    reqNAME.Enabled = true;
                    reqNAME.Validate();
                    reqFILENAME.Enabled = true;
                    reqFILENAME.Validate();
                    if (Page.IsValid)
                    {
                        HttpPostedFile pstIMPORT = fileIMPORT.PostedFile;
                        if (pstIMPORT != null)
                        {
                            if (pstIMPORT.FileName.Length > 0)
                            {
                                string sFILENAME       = Path.GetFileName(pstIMPORT.FileName);
                                string sFILE_EXT       = Path.GetExtension(sFILENAME);
                                string sFILE_MIME_TYPE = pstIMPORT.ContentType;

                                RdlDocument rdl = new RdlDocument();
                                rdl.Load(pstIMPORT.InputStream);
                                rdl.SetSingleNodeAttribute(rdl.DocumentElement, "Name", txtNAME.Text);
                                // 10/22/2007 Paul.  Use the Assigned User ID field when saving the record.
                                Guid gID = Guid.Empty;
                                SqlProcs.spREPORTS_Update(ref gID, Sql.ToGuid(txtASSIGNED_USER_ID.Value), txtNAME.Text, lstMODULE.SelectedValue, lstREPORT_TYPE.SelectedValue, rdl.OuterXml);
                            }
                        }
                        Response.Redirect("default.aspx");
                    }
                }
                else if (e.CommandName == "Cancel")
                {
                    Response.Redirect("default.aspx");
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                ctlImportButtons.ErrorText = ex.Message;
            }
        }
        public void RunReport(string sRDL)
        {
            try
            {
                RdlDocument rdl = new RdlDocument();
                rdl.LoadRdl(sRDL);

                DbProviderFactory dbf = DbProviderFactories.GetFactory();
                using ( IDbConnection con = dbf.CreateConnection() )
                {
                    using ( IDbCommand cmd = con.CreateCommand() )
                    {
                        rdl.BuildCommand(cmd);
                        sReportSQL = Sql.ExpandParameters(cmd);

                        using ( DbDataAdapter da = dbf.CreateDataAdapter() )
                        {
                            ( (IDbDataAdapter) da ).SelectCommand = cmd;
                            dtReport = new DataTable();
                            {
                                da.Fill(dtReport);

                                // 07/12/2006 Paul.  Every date cell needs to be localized.
                                foreach ( DataRow row in dtReport.Rows )
                                {
                                    foreach ( DataColumn col in dtReport.Columns )
                                    {
                                        if ( col.DataType == typeof(System.DateTime) )
                                        {
                                            // 07/13/2006 Paul.  Don't try and translate a NULL.
                                            if ( row[col.Ordinal] != DBNull.Value )
                                                row[col.Ordinal] = T10n.FromServerTime(row[col.Ordinal]);
                                        }
                                    }
                                }
                                /*
                                http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=444154&SiteID=1
                                Brian Hartman - MSFT  06 Jun 2006, 10:22 PM UTC
                                LocalReport has a limitation that the report definition can't be changed once the report has been processed.
                                In winforms, you can use the ReportViewer.Reset() method to force the viewer to create a new instance of
                                LocalReport and workaround this issue.  But this method is currently not on the webforms version of report viewer.
                                We hope to add it in an upcoming service pack, but for now,
                                you must workaround this issue by creating a new instance of the ReportViewer.
                                */
                                /*
                                // 07/09/2006 Paul.  Creating a new viewer solves the reset problem, but breaks ReportViewer pagination.
                                rdlViewer = new ReportViewer();
                                rdlViewer.ID                  = "rdlViewer";
                                rdlViewer.Font.Names          = new string[] { "Verdana" };
                                rdlViewer.Font.Size           = new FontUnit("8pt");
                                rdlViewer.Height              = new Unit("100%");
                                rdlViewer.Width               = new Unit("100%");
                                rdlViewer.AsyncRendering      = false;
                                rdlViewer.SizeToReportContent = true;
                                divReportView.Controls.Clear();
                                divReportView.Controls.Add(rdlViewer);
                                */

                                // 06/21/2006 Paul.  The DataSource Name must match the value in the report.
                                string sDataSetName = rdl.SelectNodeValue("Body/ReportItems/Table/DataSetName");
                                ReportDataSource rds = new ReportDataSource(sDataSetName, dtReport);
                                rdlViewer.ProcessingMode = ProcessingMode.Local;
                                // 06/25/2006 Paul.  The data sources need to be cleared, otherwise the report will not refresh.
                                rdlViewer.LocalReport.DataSources.Clear();
                                rdlViewer.LocalReport.DataSources.Add(rds);
                                rdlViewer.LocalReport.DisplayName = rdl.SelectNodeAttribute(String.Empty, "Name");

                                // 07/13/2006 Paul.  The ReportViewer is having a problem interpreting the date functions.
                                // To solve the problem, we should go through all the parameters and replace the date functions with values.
                                rdl.ReportViewerFixups();
                                StringReader sr = new StringReader(rdl.OuterXml);
                                rdlViewer.LocalReport.LoadReportDefinition(sr);
                                // 06/25/2006 Paul.  Refresh did not work, clear the data sources instead.
                                //rdlViewer.LocalReport.Refresh();
                                rdlViewer.DataBind();
                            }
                        }
                    }
                }
            }
            catch ( Exception ex )
            {
                lblError.Text = Utils.ExpandException(ex);
            }
        }
Example #5
0
 protected void lstMODULE_Changed(Object sender, EventArgs e)
 {
     lblMODULE.Text = lstMODULE.SelectedValue;
     // 05/26/2006 Paul.  If the module changes, then throw away everything.
     // The display columns don't count, the group columns don't count, etc.
     rdl = new RdlDocument(txtNAME.Text, txtASSIGNED_TO.Text);
     rdl.SetCustomProperty("Module"        , lstMODULE.SelectedValue );
     rdl.SetCustomProperty("Related"       , String.Empty);
     rdl.SetCustomProperty("RelatedModules", String.Empty);
     rdl.SetCustomProperty("Relationships" , String.Empty);
     rdl.SetCustomProperty("Filters"       , String.Empty);
     lstRELATED_Bind();
     lblRELATED.Text = lstRELATED.SelectedValue;
     dgFilters.DataSource = ReportFilters();
     dgFilters.DataBind();
     BuildReportSQL();
     // 07/13/2006 Paul.  The DisplayColumns List must be bound after the ReportSQL is built.
     lstLeftListBox_Bind();
     ctlReportView.ClearReport();
 }
Example #6
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            Utils.SetPageTitle(Page, L10n.Term(".moduleList." + m_sMODULE));
            // 06/04/2006 Paul.  Visibility is already controlled by the ASPX page, but it is probably a good idea to skip the load.
            this.Visible = (SplendidCRM.Security.GetUserAccess(m_sMODULE, "edit") >= 0);
            if ( !this.Visible )
                return;

            reqNAME.DataBind();
            lblDisplayColumnsRequired.DataBind();
            lblDisplayColumnsRequired.Visible = false;

            rdl = new RdlDocument();
            #if DEBUG
            bDebug = true;
            #endif
            lblMODULE              .Visible = bDebug;
            lblRELATED             .Visible = bDebug;
            lblMODULE_COLUMN_SOURCE.Visible = bDebug;
            lblFILTER_COLUMN_SOURCE.Visible = bDebug;
            lblFILTER_COLUMN       .Visible = bDebug;
            lblFILTER_OPERATOR_TYPE.Visible = bDebug;
            lblFILTER_OPERATOR     .Visible = bDebug;
            lblFILTER_ID           .Visible = bDebug;
            try
            {
                gID = Sql.ToGuid(Request["ID"]);

                bRun = Sql.ToBoolean(Request["Run"]);
                string sRdl = Sql.ToString(Session["rdl"]);
                // 07/09/2006 Paul.  The ReportViewer has a bug that prevents it from reloading a previous RDL.
                // The only solution is to create a new ReportViewer object.
                if ( bRun && sRdl.Length > 0 )
                {
                    // 07/13/2006 Paul.  We don't store the SHOW_QUERY value in the RDL, so we must retrieve it from the session.
                    chkSHOW_QUERY.Checked = Sql.ToBoolean(Session["Reports.SHOW_QUERY"]);
                    // 07/09/2006 Paul.  Clear the Run parameter on the command line.
                    Page.RegisterClientScriptBlock("frmRedirect", "<script>document.forms[0].action='edit.aspx?ID=" + gID.ToString() + "';</script>");
                    // 07/09/2006 Paul.  Clear the session variable as soon as we are done loading it.
                    //Session.Remove("rdl");
                    rdl.LoadRdl(sRdl);

                    txtNAME.Text              = rdl.SelectNodeAttribute(String.Empty, "Name");
                    txtACTIVE_TAB.Value       = "1";
                    radREPORT_TYPE_TABULAR.Checked = true;
                    txtASSIGNED_USER_ID.Value = rdl.GetCustomPropertyValue("AssignedUserID");
                    txtASSIGNED_TO.Text       = rdl.SelectNodeValue("Author");

                    SetReportType(rdl.GetCustomPropertyValue("ReportType"));
                    ctlModuleHeader.Title = rdl.SelectNodeAttribute(String.Empty, "Name");
                    Utils.SetPageTitle(Page, L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title);
                    ViewState["ctlModuleHeader.Title"] = ctlModuleHeader.Title;
                    ViewState["ASSIGNED_USER_ID"     ] = txtASSIGNED_USER_ID.Value;

                    try
                    {
                        lstMODULE.DataSource = SplendidCache.ReportingModules();
                        lstMODULE.DataBind();
                        lstMODULE.SelectedValue = rdl.GetCustomPropertyValue("Module");
                    }
                    catch(Exception ex)
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                    }
                    lstRELATED_Bind();
                    try
                    {
                        lstRELATED.SelectedValue = rdl.GetCustomPropertyValue("Related");
                    }
                    catch
                    {
                    }
                    ctlDisplayColumnsChooser_Bind();
                    BuildReportSQL();
                    // 07/13/2006 Paul.  The DisplayColumns List must be bound after the ReportSQL is built.
                    lstLeftListBox_Bind();

                    dgFilters.DataSource = ReportFilters();
                    dgFilters.DataBind();

                    ctlReportView.RunReport(rdl.OuterXml);
                }
                else if ( !IsPostBack )
                {
                    txtNAME.Text              = "untitled";
                    txtACTIVE_TAB.Value       = "1";
                    radREPORT_TYPE_TABULAR.Checked = true;
                    txtASSIGNED_TO.Text       = Security.USER_NAME;
                    txtASSIGNED_USER_ID.Value = Security.USER_ID.ToString();
                    ViewState["ASSIGNED_USER_ID"] = txtASSIGNED_USER_ID.Value;
                    lstMODULE.DataSource = SplendidCache.ReportingModules();
                    lstMODULE.DataBind();
                    lblMODULE.Text = lstMODULE.SelectedValue;

                    // 07/13/2006 Paul.  We don't store the SHOW_QUERY value in the RDL, so we must retrieve it from the session.
                    chkSHOW_QUERY.Checked = Sql.ToBoolean(Session["Reports.SHOW_QUERY"]);

                    Guid gDuplicateID = Sql.ToGuid(Request["DuplicateID"]);
                    if ( !Sql.IsEmptyGuid(gID) || !Sql.IsEmptyGuid(gDuplicateID) )
                    {
                        DbProviderFactory dbf = DbProviderFactories.GetFactory();
                        using ( IDbConnection con = dbf.CreateConnection() )
                        {
                            string sSQL;
                            sSQL = "select *             " + ControlChars.CrLf
                                 + "  from vwREPORTS_Edit" + ControlChars.CrLf
                                 + " where ID = @ID      " + ControlChars.CrLf;
                            using ( IDbCommand cmd = con.CreateCommand() )
                            {
                                cmd.CommandText = sSQL;
                                if ( !Sql.IsEmptyGuid(gDuplicateID) )
                                {
                                    Sql.AddParameter(cmd, "@ID", gDuplicateID);
                                    gID = Guid.Empty;
                                }
                                else
                                {
                                    Sql.AddParameter(cmd, "@ID", gID);
                                }
                                con.Open();
            #if DEBUG
                                Page.RegisterClientScriptBlock("SQLCode", Sql.ClientScriptBlock(cmd));
            #endif
                                using ( IDataReader rdr = cmd.ExecuteReader(CommandBehavior.SingleRow) )
                                {
                                    if ( rdr.Read() )
                                    {
                                        ctlModuleHeader.Title = Sql.ToString(rdr["NAME"]);
                                        Utils.SetPageTitle(Page, L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title);
                                        ViewState["ctlModuleHeader.Title"] = ctlModuleHeader.Title;

                                        txtNAME.Text              = Sql.ToString(rdr["NAME"            ]);
                                        txtASSIGNED_USER_ID.Value = Sql.ToString(rdr["ASSIGNED_USER_ID"]);
                                        txtASSIGNED_TO.Text       = Sql.ToString(rdr["ASSIGNED_TO"     ]);
                                        ViewState["ASSIGNED_USER_ID"] = txtASSIGNED_USER_ID.Value;

                                        string sXML = Sql.ToString(rdr["RDL"]);
                                        try
                                        {
                                            if ( !Sql.IsEmptyString(sXML) )
                                            {
                                                rdl.LoadRdl(Sql.ToString(rdr["RDL"]));

                                                SetReportType(rdl.GetCustomPropertyValue("ReportType"));
                                                // 07/09/2006 Paul.  Update Assigned values as they may have changed externally.
                                                rdl.SetCustomProperty("AssignedUserID", txtASSIGNED_USER_ID.Value);
                                                rdl.SetSingleNode("Author", txtASSIGNED_TO.Text);
                                                lstMODULE.SelectedValue = rdl.GetCustomPropertyValue("Module");
                                                lblMODULE.Text = lstMODULE.SelectedValue;
                                            }
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                            }
                        }
                    }
                    // 05/27/2006 Paul.  This is a catch-all statement to create a new report if all else fails.
                    if ( rdl.DocumentElement == null )
                    {
                        rdl = new RdlDocument(txtNAME.Text, txtASSIGNED_TO.Text);
                        rdl.SetCustomProperty("Module"        , lstMODULE.SelectedValue  );
                        rdl.SetCustomProperty("Related"       , lstRELATED.SelectedValue );
                        rdl.SetCustomProperty("ReportType"    , GetReportType()          );
                        rdl.SetCustomProperty("AssignedUserID", txtASSIGNED_USER_ID.Value);
                    }
                    lstRELATED_Bind();
                    lblRELATED.Text = lstRELATED.SelectedValue;
                    try
                    {
                        lstRELATED.SelectedValue = rdl.GetCustomPropertyValue("Related");
                    }
                    catch
                    {
                    }
                    BuildReportSQL();
                    // 07/13/2006 Paul.  The DisplayColumns List must be bound after the ReportSQL is built.
                    lstLeftListBox_Bind();

                    dgFilters.DataSource = ReportFilters();
                    dgFilters.DataBind();
                }
                else
                {
                    // 07/13/2006 Paul.  Save the SHOW_QUERY flag in the Session so that it will be available across redirects.
                    Session["Reports.SHOW_QUERY"] = chkSHOW_QUERY.Checked;

                    sRdl = Sql.ToString(ViewState["rdl"]);
                    rdl.LoadRdl(sRdl);
                    rdl.SetSingleNodeAttribute(rdl.DocumentElement, "Name", txtNAME.Text);
                    if ( Sql.ToString(ViewState["ASSIGNED_USER_ID"]) != txtASSIGNED_USER_ID.Value )
                    {
                        txtASSIGNED_TO.Text = Crm.Users.USER_NAME(Sql.ToGuid(txtASSIGNED_USER_ID.Value));
                        ViewState["ASSIGNED_USER_ID"] = txtASSIGNED_USER_ID.Value;
                    }
                    rdl.SetCustomProperty("ReportType"    , GetReportType()          );
                    rdl.SetCustomProperty("AssignedUserID", txtASSIGNED_USER_ID.Value);
                    rdl.SetSingleNode("Author", txtASSIGNED_TO.Text);
                    // 07/15/2006 Paul.  The DisplayColumns custom node will not be the primary location of the column data.
                    // Always just push to the RDL Headers instead of trying to read from them.
                    DisplayColumnsUpdate();
                    XmlDocument xmlDisplayColumns = rdl.GetCustomProperty("DisplayColumns");
                    DataTable dtDisplayColumns = XmlUtil.CreateDataTable(xmlDisplayColumns.DocumentElement, "DisplayColumn", new string[] { "Label", "Field"});
                    rdl.UpdateDataTable(dtDisplayColumns);
                    xmlDisplayColumns = null;

                    ctlDisplayColumnsChooser_Bind();
                    BuildReportSQL();
                    // 07/13/2006 Paul.  The DisplayColumns List must be bound after the ReportSQL is built.
                    lstLeftListBox_Bind();

                    dgFilters.DataSource = ReportFilters();
                    dgFilters.DataBind();

                    // 12/02/2005 Paul.  When validation fails, the header title does not retain its value.  Update manually.
                    ctlModuleHeader.Title = Sql.ToString(ViewState["ctlModuleHeader.Title"]);
                    Utils.SetPageTitle(Page, L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title);
                }
            #if DEBUG
                //Page.RegisterClientScriptBlock("ReportSQL", "<script type=\"text/javascript\">sDebugSQL += '" + Sql.EscapeJavaScript("\r" + sReportSQL) + "';</script>");
            #endif
            }
            catch(Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                ctlReportButtons.ErrorText = ex.Message;
            }
        }
        public void RunReport(string sRDL)
        {
            try
            {
                RdlDocument rdl = new RdlDocument();
                rdl.LoadRdl(sRDL);

                DbProviderFactory dbf = DbProviderFactories.GetFactory();
                using (IDbConnection con = dbf.CreateConnection())
                {
                    using (IDbCommand cmd = con.CreateCommand())
                    {
                        rdl.BuildCommand(cmd);
                        sReportSQL = Sql.ExpandParameters(cmd);

                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            dtReport = new DataTable();
                            {
                                da.Fill(dtReport);

                                // 07/12/2006 Paul.  Every date cell needs to be localized.
                                foreach (DataRow row in dtReport.Rows)
                                {
                                    foreach (DataColumn col in dtReport.Columns)
                                    {
                                        if (col.DataType == typeof(System.DateTime))
                                        {
                                            // 07/13/2006 Paul.  Don't try and translate a NULL.
                                            if (row[col.Ordinal] != DBNull.Value)
                                            {
                                                row[col.Ordinal] = T10n.FromServerTime(row[col.Ordinal]);
                                            }
                                        }
                                    }
                                }

                                /*
                                 * http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=444154&SiteID=1
                                 * Brian Hartman - MSFT  06 Jun 2006, 10:22 PM UTC
                                 * LocalReport has a limitation that the report definition can't be changed once the report has been processed.
                                 * In winforms, you can use the ReportViewer.Reset() method to force the viewer to create a new instance of
                                 * LocalReport and workaround this issue.  But this method is currently not on the webforms version of report viewer.
                                 * We hope to add it in an upcoming service pack, but for now,
                                 * you must workaround this issue by creating a new instance of the ReportViewer.
                                 */
                                /*
                                 * // 07/09/2006 Paul.  Creating a new viewer solves the reset problem, but breaks ReportViewer pagination.
                                 * rdlViewer = new ReportViewer();
                                 * rdlViewer.ID                  = "rdlViewer";
                                 * rdlViewer.Font.Names          = new string[] { "Verdana" };
                                 * rdlViewer.Font.Size           = new FontUnit("8pt");
                                 * rdlViewer.Height              = new Unit("100%");
                                 * rdlViewer.Width               = new Unit("100%");
                                 * rdlViewer.AsyncRendering      = false;
                                 * rdlViewer.SizeToReportContent = true;
                                 * divReportView.Controls.Clear();
                                 * divReportView.Controls.Add(rdlViewer);
                                 */

                                // 06/21/2006 Paul.  The DataSource Name must match the value in the report.
                                string           sDataSetName = rdl.SelectNodeValue("Body/ReportItems/Table/DataSetName");
                                ReportDataSource rds          = new ReportDataSource(sDataSetName, dtReport);
                                rdlViewer.ProcessingMode = ProcessingMode.Local;
                                // 06/25/2006 Paul.  The data sources need to be cleared, otherwise the report will not refresh.
                                rdlViewer.LocalReport.DataSources.Clear();
                                rdlViewer.LocalReport.DataSources.Add(rds);
                                rdlViewer.LocalReport.DisplayName = rdl.SelectNodeAttribute(String.Empty, "Name");

                                // 07/13/2006 Paul.  The ReportViewer is having a problem interpreting the date functions.
                                // To solve the problem, we should go through all the parameters and replace the date functions with values.
                                rdl.ReportViewerFixups();
                                StringReader sr = new StringReader(rdl.OuterXml);
                                rdlViewer.LocalReport.LoadReportDefinition(sr);
                                // 06/25/2006 Paul.  Refresh did not work, clear the data sources instead.
                                //rdlViewer.LocalReport.Refresh();
                                rdlViewer.DataBind();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                lblError.Text = Utils.ExpandException(ex);
            }
        }