/// <summary>
        /// Provides data to the datasources
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void m_DashboardViewer_DataLoading(object sender, DataLoadingWebEventArgs e)
        {
            string      componentName  = String.Empty;
            string      dataSourceName = String.Empty;
            object      dataCollection = null;
            Preferences subkey         = null;

            //
            // Get the information about the datasource
            //
            componentName  = e.DataSourceComponentName;
            dataSourceName = e.DataSourceName;

            /*
            ** Check if this is a JAMS DataSource and if so, load the data.
            */
            try
            {
                //
                // We must have a preferences object to load JAMS datasources
                //
                if (m_Preferences != null)
                {
                    // Get the Preferences subkey for this datasource
                    subkey = m_Preferences.OpenSubKey(dataSourceName);

                    if (subkey != null)
                    {
                        // History datasource
                        if (componentName.StartsWith("HistoryDS"))
                        {
                            //
                            // Load each History parameter from Preferences and if the value starts with '$'
                            //  try to get the value from a matching Dashboard parameter.
                            //
                            string folderName           = GetParameterValue(subkey, "QueryFolderName", @"\");
                            string jobName              = GetParameterValue(subkey, "QueryJobName", "*");
                            string setupName            = GetParameterValue(subkey, "QuerySetupName", "*");
                            string startDateRaw         = GetParameterValue(subkey, "QueryStartDate", "Today");
                            string startTime            = GetParameterValue(subkey, "QueryStartTime", "00:00:00.00");
                            string endDateRaw           = GetParameterValue(subkey, "QueryEndDate", "Tomorrow");
                            string endTime              = GetParameterValue(subkey, "QueryEndTime", "00:00:00.00");
                            string withinDelta          = GetParameterValue(subkey, "QueryWithin", "0");
                            string includeSuccess       = GetParameterValue(subkey, "QueryIncludeSuccess", "true");
                            string includeInfo          = GetParameterValue(subkey, "QueryIncludeInfo", "true");
                            string includeWarning       = GetParameterValue(subkey, "QueryIncludeWarning", "true");
                            string includeError         = GetParameterValue(subkey, "QueryIncludeError", "true");
                            string includeFatal         = GetParameterValue(subkey, "QueryIncludeFatal", "true");
                            string checkSched           = GetParameterValue(subkey, "QueryCheckSched", "true");
                            string checkHold            = GetParameterValue(subkey, "QueryCheckHold", "true");
                            string checkStart           = GetParameterValue(subkey, "QueryCheckStart", "true");
                            string checkCompletion      = GetParameterValue(subkey, "QueryCheckCompletion", "true");
                            string searchRecursivelyRaw = GetParameterValue(subkey, "QuerySearchRecursively", "true");
                            bool   useDates             = subkey.GetBoolean("QueryUseDates", true);

                            DateTime           startDate            = DateTime.MinValue;
                            DateTime           endDate              = DateTime.MinValue;
                            bool               searchRecursively    = Boolean.Parse(searchRecursivelyRaw);
                            ComparisonOperator searchFolderOperator = ComparisonOperator.MatchFolder;

                            //
                            // Determine the Start & End dates based either on the WithinTime or date range
                            //
                            if (useDates)
                            {
                                startDate  = Date.Evaluate(startDateRaw, Server).Date;
                                startDate += Date.Evaluate(startTime, Server).TimeOfDay;

                                endDate  = Date.Evaluate(endDateRaw, Server).Date;
                                endDate += Date.Evaluate(endTime, Server).TimeOfDay;
                            }
                            else
                            {
                                //
                                //  They are using the "Within..." controls,
                                //  the end date is right now and the start date is the current time minus the delta.
                                //
                                startDate = DateTime.Now - DeltaTime.Parse(withinDelta).TimeSpan;
                                endDate   = DateTime.Now;
                            }

                            //
                            // Add History Search Criteria
                            //
                            List <HistorySelection> selectionList = new List <HistorySelection>();
                            selectionList.Add(new HistorySelection(HistorySelectionField.JobName, ComparisonOperator.Like, jobName));
                            selectionList.Add(new HistorySelection(HistorySelectionField.SetupName, ComparisonOperator.Like, setupName));

                            if (searchRecursively)
                            {
                                searchFolderOperator = ComparisonOperator.MatchFolderRecursively;
                            }
                            selectionList.Add(new HistorySelection(HistorySelectionField.FolderName, searchFolderOperator, folderName));


                            //
                            // Query History using the supplied values
                            //
                            dataCollection = JAMS.History.Find(selectionList,
                                                               startDate,
                                                               endDate,
                                                               Boolean.Parse(includeSuccess),
                                                               Boolean.Parse(includeInfo),
                                                               Boolean.Parse(includeWarning),
                                                               Boolean.Parse(includeError),
                                                               Boolean.Parse(includeFatal),
                                                               Boolean.Parse(checkSched),
                                                               Boolean.Parse(checkHold),
                                                               Boolean.Parse(checkStart),
                                                               Boolean.Parse(checkCompletion),
                                                               HistorySearchOptions.None,
                                                               Server);
                        }
                        else if (componentName.StartsWith("CompletionsBySeverityDS"))
                        {
                            DateTime  startDate        = DateTime.Now;
                            DeltaTime lookbackInterval = DeltaTime.Zero;

                            //
                            // Load the lookbackInterval from Preferences and if the value starts with '$'
                            //  try to get the value from a matching Dashboard parameter.
                            //
                            string lookbackIntervalRaw = GetParameterValue(subkey, "QueryLookBackInterval", "00:00:00.00");

                            //
                            // The startDate will be the current time minus the lookback interval
                            //
                            if (DeltaTime.TryParse(lookbackIntervalRaw, out lookbackInterval))
                            {
                                startDate = startDate.Subtract(lookbackInterval.ToTimeSpan());
                            }

                            //
                            // Retrieve the completion data that occured within 24 hours before the startDate
                            //
                            dataCollection = Statistics.GetCompletionsBySeverity(startDate, Server);
                        }
                        else if (componentName.StartsWith("QueueDS"))
                        {
                            //
                            // Load the BatchQueue mask parameter and if the value starts with '$'
                            //  try to get the value from a matching Dashboard parameter.
                            //
                            string queueMask = GetParameterValue(subkey, "QueryQueueName", "*");

                            //
                            // Retrieve the queue data
                            //
                            dataCollection = BatchQueue.Find(queueMask, Server);
                        }
                        else if (componentName.StartsWith("ResourceDS"))
                        {
                            //
                            // Load the Resource mask parameter and if the value starts with '$'
                            //  try to get the value from a matching Dashboard parameter.
                            //
                            string resourceMask = GetParameterValue(subkey, "QueryResourceName", "*");

                            //
                            // Retrieve the Resource data
                            //
                            dataCollection = Resource.Find(resourceMask, Server);
                        }
                        else if (componentName.StartsWith("AgentDS"))
                        {
                            //
                            // Load the Agent mask parameter and if the value starts with '$'
                            //  try to get the value from a matching Dashboard parameter.
                            //
                            string agentMask = GetParameterValue(subkey, "QueryAgentName", "*");

                            //
                            // Retrieve the Agent data
                            //
                            dataCollection = Agent.Find(agentMask, Server);
                        }
                        else if (componentName.StartsWith("PowerShellDS"))
                        {
                            dataCollection = GetPowerShellDataSourceData(subkey);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            if (dataCollection != null)
            {
                e.Data = dataCollection;
            }
        }