Esempio n. 1
0
        private void loadPolicyMetrics()
        {
            //string err_section = "Security Summary Information";
            try
            {
                if (m_importing)
                {
                    m_metrics = m_policy.GetExistingPolicyMetrics(Program.gController.Repository.ConnectionString);
                }
                else
                {
                    m_metrics = m_policy.GetPolicyMetrics(Program.gController.Repository.ConnectionString);
                }

                if (m_metrics != null)
                {
                    m_InternalUpdate = true;

                    //save the current grid settings to restore after importing.
                    GridSettings settings = GridSettings.GetSettings(ultraGridPolicyMetrics);

                    ultraGridPolicyMetrics.DataSource = m_metrics;
                    updateVulnerabilityLayout();
                    ultraGridPolicyMetrics.ActiveRow = null;
                    ultraGridPolicyMetrics.Selected.Rows.Clear();

                    //restore the saved grid settings so it appears the same to the user
                    settings.ApplySettingsToGrid(ultraGridPolicyMetrics);

                    m_InternalUpdate = false;
                    UltraGridRow[] rows = ultraGridPolicyMetrics.Rows.GetAllNonGroupByRows();
                    if (rows.GetLength(0) > 0)
                    {
                        ultraGridPolicyMetrics.Selected.Rows.Add(rows[0]);
                        rows[0].Activate();
                    }
                }
            }
            catch (Exception ex)
            {
                logX.loggerX.Error("Error loading PolicyMetrics", ex);
            }

            UpdateEnabledCount();
        }