示例#1
0
    private static string GetColumnDataTypeFromName(string name)
    {
        foreach (KeyValuePair <string, string[]> column in DalTranslator.GetTraceData().Columns)
        {
            if (column.Value[0] == name)
            {
                return(column.Value[2]);
            }
        }

        return(null);
    }
示例#2
0
    private void InitializeDataViewer(bool inititalizeUserInterface, bool useConnectToSessionTimeAsImportTime, string sortingColumn, ListSortDirection sortingColumnDirection)
    {
        if (inititalizeUserInterface)
        {
            _dataViewerParametersDataViewer1 = DalTranslator.GetTraceData();

            ColumnPropertiesHandler.LoadColumnWidthAndOrder(_dataViewerParametersDataViewer1, "DataViewer_TraceData");
            ToggleShowHiddenColumns();

            if (useConnectToSessionTimeAsImportTime)
            {
                ConfigHandler.ImportStartTime = DateTime.Now;
            }

            SetUserInterface();

            if (useConnectToSessionTimeAsImportTime)
            {
                ConfigHandler.ImportEndTime = DateTime.Now;
            }
        }

        _dataViewerParametersDataViewer1.SortingColumn          = sortingColumn;
        _dataViewerParametersDataViewer1.SortingColumnDirection = sortingColumnDirection;

        dataViewer1.UpdateDataSourceEvent          += _databaseOperation.UpdateDataSource;
        dataViewer1.RequestDataSourceAllPagesEvent += _databaseOperation.RequestDataSourceAllPages;
        dataViewer1.SelectionChangedEvent          += DataViewer1_SelectionChangedEvent;
        dataViewer1.DoubleClickEvent += DataViewer1_DoubleClickEvent;
        dataViewer1.RightClickEvent  += DataViewer1_RightClickEvent;

        dataViewer1.ColumnWidthChangedEvent        += DataViewer1_ColumnWidthChangedEvent;
        dataViewer1.ColumnDisplayIndexChangedEvent += DataViewer1_ColumnDisplayIndexChangedEvent;

        dataViewer1.ShowOutputEvent += DataViewer1_ShowOutputEvent;

        dataViewer1.SetDateFormatShow(ConfigHandler.DateTimeLongFormat);
        dataViewer1.SetDateFormatSearch(ConfigHandler.DateFormatSearch);
        dataViewer1.SetUseDateSelector(ConfigHandler.UseDateSelectorInQuickSearch);

        dataViewer1.LoadData(_dataViewerParametersDataViewer1);

        Visible = true;
    }
示例#3
0
    public void Initialize(DatabaseOperation databaseOperation)
    {
        InitializeDictionary();

        _databaseOperation = databaseOperation;
        _dataViewerParametersDataViewer1 = DalTranslator.GetTraceData();
        ColumnPropertiesHandler.LoadColumnWidthAndOrder(_dataViewerParametersDataViewer1, "DataViewer_TraceData");

        _searchForm = new SearchTextForm();
        _searchForm.Initialize();

        if (ConfigHandler.UseTranslation)
        {
            _searchForm.SetTitle(Translator.GetText("searchInTextData"));
        }
        else
        {
            _searchForm.SetTitle("Search in TextData");
        }

        filter1UserControl.ApplyEvent += Filter1UserControl_ApplyEvent;
        filter1UserControl.ResetEvent += Filter1UserControl_ResetEvent;

        filter2UserControl.ApplyEvent += Filter2UserControl_ApplyEvent;
        filter2UserControl.ResetEvent += Filter2UserControl_ResetEvent;

        textDataTextBox.SetHighlighting("SQL");
        textDataTextBox.Document.HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("SQL");

        textDataTextBox.TextEditorProperties.Font = new Font(ConfigHandler.TextDataFontFamily, float.Parse(ConfigHandler.TextDataFontSize));
        textDataTextBox.Font = new Font(ConfigHandler.TextDataFontFamily, float.Parse(ConfigHandler.TextDataFontSize));

        textDataTextBox.ActiveTextAreaControl.Caret.PositionChanged += Caret_PositionChanged;
        _searchForm.SearchEvent += SearchForm_SearchEvent;

        ConfigHandler.ActiveFilters = new List <Filter>();
    }
    private void ExportSessionToSession()
    {
        string newSessionName = sessionNameTextBox.Text.Trim();
        bool   validName      = ValidateSessionName(newSessionName);

        if (validName)
        {
            _databaseOperation.ExportSessionToSessionReadyEvent += DatabaseOperation_ExportSessionToSessionReadyEvent;

            int page = _dataViewer.GetPage();

            if (allPagesRadioButton.Checked)
            {
                page = -1;
            }

            _databaseOperation.ExportSessionToSession(newSessionName, _dataViewer, "ExportSessionToSession.sql", page, ConfigHandler.ItemsPerPage, _dataViewer.GetSortingColumn(), _dataViewer.GetSortingColumnDirection(), _dataViewer.GetSearchTerm(), _dataViewer.GetSearchColumn(), DalTranslator.GetTraceData().Columns, _dataViewer.GetWhere(), _dataViewer.GetWhereActive());
        }
    }
示例#5
0
 public void UpdateColumnWidthAndOrder()
 {
     dataViewer1.ReInitializeDataGrid();
     dataViewer1.UpdateColumnWidth(DalTranslator.GetTraceData().Columns);
     dataViewer1.UpdateColumnOrder(DalTranslator.GetTraceData().Columns);
 }
示例#6
0
    public void Initialize(DatabaseOperation databaseOperation, List <string> groupBys, bool filter1Applied, bool filter2Applied, bool unattended, int totalRows)
    {
        InitializeDictionary();
        Text = GenericHelper.ApplicationName;
        SetSize();

        _toolTip   = new ToolTip();
        _totalRows = totalRows;

        _groupBys          = groupBys;
        _databaseOperation = databaseOperation;

        string where = GetWhere();
        _dataViewerParametersDataViewer1 = DalTranslator.GetStatisticsData();

        if (!unattended)
        {
            ColumnPropertiesHandler.LoadColumnWidthAndOrder(_dataViewerParametersDataViewer1, "DataViewer_StatisticsData");
        }
        else
        {
            List <KeyValuePair <string, string[]> > columnsToReorder = new List <KeyValuePair <string, string[]> >();

            foreach (KeyValuePair <string, string[]> visibleColumn in _dataViewerParametersDataViewer1.Columns)
            {
                if (groupBys.Contains(visibleColumn.Key))
                {
                    columnsToReorder.Add(visibleColumn);
                }
            }

            for (int i = 0; i < groupBys.Count; i++)
            {
                foreach (KeyValuePair <string, string[]> column in columnsToReorder)
                {
                    if (column.Key == groupBys[i])
                    {
                        Dictionary <string, string[]> newColumns = ColumnPropertiesHandler.ChangeColumnOrder(_dataViewerParametersDataViewer1, column.Key, i - 1);
                        _dataViewerParametersDataViewer1.Columns = newColumns;
                    }
                }
            }
        }

        DataViewerParameters dataViewerParameters = DalTranslator.GetTraceData();

        foreach (KeyValuePair <string, string[]> column in dataViewerParameters.Columns)
        {
            if (ConfigHandler.GroupByColumns.Contains(column.Key))
            {
                _dataViewerParametersDataViewer1.Columns[column.Key].SetValue("SearchableShow", 4);
            }
            else
            {
                _dataViewerParametersDataViewer1.Columns[column.Key].SetValue("NonSearchableHide", 4);
            }
        }

        _dataViewerParametersDataViewer1.WhereActive = where;

        if (!unattended)
        {
            ColumnPropertiesHandler.SaveColumnWidthAndOrder(_dataViewerParametersDataViewer1, "DataViewer_StatisticsData");
        }

        InitializeDataViewer();

        DataSet dataSet = dataViewer1.GetDataSource();

        if (dataSet.Tables[1].Rows[0]["MinStartTime"] != DBNull.Value)
        {
            _minStartTime = Convert.ToDateTime(dataSet.Tables[1].Rows[0]["MinStartTime"]);
        }

        if (dataSet.Tables[1].Rows[0]["MaxStartTime"] != DBNull.Value)
        {
            _maxStartTime = Convert.ToDateTime(dataSet.Tables[1].Rows[0]["MaxStartTime"]);
        }

        SetFilterLabel(filter1Applied, filter2Applied);
        InitializeShowCheckBoxes();

        MinimumSize = new Size(900, 680);         // error in .NET
    }