Пример #1
0
        /// <summary>Get data to show in grid.</summary>
        /// <returns>A data table of all data.</returns>
        private DataTable GetData()
        {
            DataTable data;

            if (dataStore != null)
            {
                int start = 0;
                int count = dataStore.MaximumResultsPerPage;
                if (ExperimentFilter != null)
                {
                    string filter = "NAME IN " + "(" + StringUtilities.Build(ExperimentFilter.Names(), delimiter: ",", prefix: "'", suffix: "'") + ")";
                    data = dataStore.GetFilteredData(view.TableList.SelectedValue, filter, start, count);
                }
                else if (SimulationFilter != null)
                {
                    data = dataStore.GetData(SimulationFilter.Name, view.TableList.SelectedValue, false, start, count);
                }
                else
                {
                    data = dataStore.GetData("*", view.TableList.SelectedValue, true, 0, dataStore.MaximumResultsPerPage);
                }
            }
            else
            {
                data = new DataTable();
            }
            return(data);
        }
Пример #2
0
        /// <summary>Get data to show in grid.</summary>
        /// <returns>A data table of all data.</returns>
        private DataTable GetData()
        {
            DataTable data;

            if (dataStore != null)
            {
                int start = 0;
                int count = Utility.Configuration.Settings.MaximumRowsOnReportGrid;
                if (ExperimentFilter != null)
                {
                    string filter = "NAME IN " + "(" + StringUtilities.Build(ExperimentFilter.GetSimulationNames(), delimiter: ",", prefix: "'", suffix: "'") + ")";
                    data = dataStore.GetData(tableName: view.TableList.SelectedValue, filter: filter, from: start, count: count);
                }
                else if (SimulationFilter != null)
                {
                    data = dataStore.GetData(simulationName: SimulationFilter.Name,
                                             tableName: view.TableList.SelectedValue,
                                             from: start, count: count);
                }
                else
                {
                    data = dataStore.GetData(tableName: view.TableList.SelectedValue,
                                             count: Utility.Configuration.Settings.MaximumRowsOnReportGrid);
                }
            }
            else
            {
                data = new DataTable();
            }
            return(data);
        }
Пример #3
0
        /// <summary>Get data to show in grid.</summary>
        /// <returns>A data table of all data.</returns>
        private DataTable GetData()
        {
            DataTable data = null;

            if (dataStore != null)
            {
                try
                {
                    int start = 0;
                    int count = Utility.Configuration.Settings.MaximumRowsOnReportGrid;

                    // Note that the filter contains the zone filter and experiment filter but not simulation filter.
                    IEnumerable <string> simulationNames = null;
                    if (ExperimentFilter != null)
                    {
                        // fixme: this makes some serious assumptions about how the query is generated in the data store layer...
                        simulationNames = ExperimentFilter.GenerateSimulationDescriptions().Select(s => s.Name);
                    }
                    else if (SimulationFilter == null)
                    {
                        simulationNames = null;
                    }
                    else
                    {
                        simulationNames = new string[] { SimulationFilter.Name }
                    };

                    string filter = GetFilter();
                    if (ZoneFilter != null)
                    {
                        // More assumptions about column names
                        filter = AppendToFilter(filter, $"[Zone] = '{ZoneFilter.Name}'");
                    }

                    data = dataStore.Reader.GetData(tableName: tableDropDown.SelectedValue,
                                                    checkpointName: checkpointDropDown.SelectedValue,
                                                    simulationNames: simulationNames,
                                                    filter: filter,
                                                    from: start,
                                                    count: count);
                }
                catch (Exception e)
                {
                    this.explorerPresenter.MainPresenter.ShowError(new Exception("Error reading data tables.", e));
                }
            }
            else
            {
                data = new DataTable();
            }

            return(data);
        }
Пример #4
0
        /// <summary>Get data to show in grid.</summary>
        /// <returns>A data table of all data.</returns>
        private DataTable GetData()
        {
            DataTable data = null;

            if (dataStore != null)
            {
                try
                {
                    int start = 0;
                    int count = Utility.Configuration.Settings.MaximumRowsOnReportGrid;
                    if (ExperimentFilter != null)
                    {
                        var    names  = ExperimentFilter.GenerateSimulationDescriptions().Select(s => s.Name);
                        string filter = "S.[Name] IN " + "(" + StringUtilities.Build(names, delimiter: ",", prefix: "'", suffix: "'") + ")";
                        if (!string.IsNullOrEmpty(view.RowFilter.Value))
                        {
                            filter += " AND " + view.RowFilter.Value;
                        }
                        data = dataStore.Reader.GetData(tableName: view.TableList.SelectedValue, filter: filter, from: start, count: count);
                    }
                    else if (SimulationFilter != null)
                    {
                        data = dataStore.Reader.GetData(
                            simulationName: SimulationFilter.Name,
                            tableName: view.TableList.SelectedValue,
                            from: start,
                            count: count,
                            filter: view.RowFilter.Value);
                    }
                    else
                    {
                        data = dataStore.Reader.GetData(
                            tableName: view.TableList.SelectedValue,
                            count: Utility.Configuration.Settings.MaximumRowsOnReportGrid,
                            filter: view.RowFilter.Value);
                    }
                }
                catch (Exception e)
                {
                    this.explorerPresenter.MainPresenter.ShowError(new Exception("Error reading data tables.", e));
                }
            }
            else
            {
                data = new DataTable();
            }

            return(data);
        }
Пример #5
0
        private string GetFilter()
        {
            string filter = rowFilterEditBox.Text;

            if (ExperimentFilter != null)
            {
                // fixme: this makes some serious assumptions about how the query is generated in the data store layer...
                IEnumerable <string> names = ExperimentFilter.GenerateSimulationDescriptions().Select(s => s.Name);
                string exptFilter          = "S.[Name] IN " + "(" + StringUtilities.Build(names, delimiter: ",", prefix: "'", suffix: "'") + ")";
                filter = AppendToFilter(filter, exptFilter);
            }

            if (filter == string.Empty)
            {
                return(null);
            }
            return(filter);
        }
Пример #6
0
        /// <summary>Get data to show in grid.</summary>
        /// <returns>A data table of all data.</returns>
        private DataTable GetData()
        {
            DataTable data = null;

            if (dataStore != null)
            {
                try
                {
                    int start = 0;
                    int count = Utility.Configuration.Settings.MaximumRowsOnReportGrid;
                    if (ExperimentFilter != null)
                    {
                        string filter = "S.NAME IN " + "(" + StringUtilities.Build(ExperimentFilter.GetSimulationNames(), delimiter: ",", prefix: "'", suffix: "'") + ")";
                        data = dataStore.GetData(tableName: view.TableList.SelectedValue, filter: filter, from: start, count: count);
                    }
                    else if (SimulationFilter != null)
                    {
                        data = dataStore.GetData(
                            simulationName: SimulationFilter.Name,
                            tableName: view.TableList.SelectedValue,
                            from: start,
                            count: count);
                    }
                    else
                    {
                        data = dataStore.GetData(
                            tableName: view.TableList.SelectedValue,
                            count: Utility.Configuration.Settings.MaximumRowsOnReportGrid);
                    }
                }
                catch (Exception e)
                {
                    this.explorerPresenter.MainPresenter.ShowError(new Exception("Error reading data tables.", e));
                }
            }
            else
            {
                data = new DataTable();
            }

            return(data);
        }
Пример #7
0
        private string GetFilter()
        {
            string filter = view.RowFilter.Value;

            if (ExperimentFilter != null)
            {
                // fixme: this makes some serious assumptions about how the query is generated in the data store layer...
                IEnumerable <string> names = ExperimentFilter.GenerateSimulationDescriptions().Select(s => s.Name);
                string exptFilter          = "S.[Name] IN " + "(" + StringUtilities.Build(names, delimiter: ",", prefix: "'", suffix: "'") + ")";
                filter = AppendToFilter(filter, exptFilter);
            }

            if (ZoneFilter != null)
            {
                // More assumptions about column names
                string zoneFilter = $"T.[Zone] = '{ZoneFilter.Name}'";
                filter = AppendToFilter(filter, zoneFilter);
            }

            return(filter);
        }
Пример #8
0
        /// <summary>Populate the grid control with data.</summary>
        public void PopulateGrid()
        {
            if (!string.IsNullOrEmpty(tableDropDown.SelectedValue))
            {
                // Note that the filter contains the zone filter and experiment filter but not simulation filter.
                IEnumerable <string> simulationNames = null;
                if (ExperimentFilter != null)
                {
                    // fixme: this makes some serious assumptions about how the query is generated in the data store layer...
                    simulationNames = ExperimentFilter.GenerateSimulationDescriptions().Select(s => s.Name);
                }
                else if (SimulationFilter == null)
                {
                    simulationNames = null;
                }
                else
                {
                    simulationNames = new string[] { SimulationFilter.Name }
                };

                string filter = rowFilterEditBox.Text;
                if (ZoneFilter != null)
                {
                    // More assumptions about column names
                    filter = AppendToFilter(filter, $"[Zone] = '{ZoneFilter.Name}'");
                }

                // Create sheet control
                if (tableDropDown.SelectedValue != null)
                {
                    try
                    {
                        // Cleanup existing sheet instances before creating new ones.
                        CleanupSheet();

                        dataProvider = new PagedDataProvider(dataStore.Reader,
                                                             checkpointDropDown.SelectedValue,
                                                             tableDropDown.SelectedValue,
                                                             simulationNames,
                                                             columnFilterEditBox.Text,
                                                             filter);
                        dataProvider.PagingStart += (sender, args) => explorerPresenter.MainPresenter.ShowWaitCursor(true);
                        dataProvider.PagingEnd   += (sender, args) => explorerPresenter.MainPresenter.ShowWaitCursor(false);

                        sheet = new SheetWidget()
                        {
                            DataProvider        = dataProvider,
                            NumberFrozenRows    = dataProvider.NumHeadingRows,
                            NumberFrozenColumns = dataProvider.NumPriorityColumns
                        };
#if NETFRAMEWORK
                        sheet.RowHeight = 20;
#endif

                        cellSelector = new SingleCellSelect(sheet);
                        var scrollbars = new SheetScrollBars(sheet);
                        sheet.CellPainter = new DefaultCellPainter(sheet, sheetSelection: cellSelector);

                        sheetContainer.Add(scrollbars.MainWidget);
                        statusLabel.Text = $"Number of rows: {dataProvider.RowCount - dataProvider.NumHeadingRows}";
                    }
                    catch (Exception err)
                    {
                        explorerPresenter.MainPresenter.ShowError(err.ToString());
                    }
                }
            }
        }