Exemplo n.º 1
0
        private void CreateNewDatabasCompleted(ExecuteQueryStatus status, DatabaseInfo dbName, IQueryResult queryResult)
        {
            if (queryResult != null)
            {
                switch (queryResult.QueryResultType)
                {
                case ResultType.StringResult:
                    resultsService.ShowStringResult(queryResult.StringOutput);
                    break;
                }
            }

            switch (status)
            {
            case ExecuteQueryStatus.Done:
                messagingService.ShowMessage("Database " + dbName.Name + " was created.", "Info");
                break;

            case ExecuteQueryStatus.Canceled:
                break;

            case ExecuteQueryStatus.Error:
                messagingService.ShowMessage("Database " + dbName.Name + " was not created !!!", "Error");
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        private void GetQueryPlanCompleted(ExecuteQueryStatus status, IQueryPlanReslult result)
        {
            SetEnableCondition(true);

            switch (status)
            {
            case ExecuteQueryStatus.Canceled:
                applicationStatus.SetStatus("Generating canceled", false);
                break;

            case ExecuteQueryStatus.Error:
                applicationStatus.SetStatus("Generating failure", false);
                queryPlanService.ShowErrorMessage(result.StringOutput);
                break;

            case ExecuteQueryStatus.Done:
                applicationStatus.SetStatus("Query Plan generated", false);

                if (result != null)
                {
                    List <MUTDOD.Common.QueryPlan> list = new List <MUTDOD.Common.QueryPlan>();
                    list.Add(result.QueryPlan);
                    queryPlanService.ShowQueryPlan(list);
                }
                else
                {
                    applicationStatus.SetStatus("Query Plan generated without result", false);
                }

                break;
            }
            m_SelectedFileName = null;
        }
Exemplo n.º 3
0
        private void ExecuteQueryCompleted(ExecuteQueryStatus status, IQueryResult result)
        {
            SetEnableCondition(true);
            switch (status)
            {
            case ExecuteQueryStatus.Canceled:
                applicationStatus.SetStatus("Query canceled", false);
                break;

            case ExecuteQueryStatus.Error:
                applicationStatus.SetStatus("Query failure", false);
                break;

            case ExecuteQueryStatus.Done:
            default:
                if (result != null)
                {
                    taskService.RemoveAll(task => task.FileName == m_SelectedFileName);
                    applicationStatus.SetStatus("Query executed", false);
                    resultsService.ShowStringResult(result.StringOutput);

                    try
                    {
                        string     refactoredResults = RefactorResults(result.StringOutput);
                        DataMatrix dm = CreateDataMatrix(refactoredResults);
                        resultsService.ShowDataResult(dm);
                    }
                    catch (XmlException)
                    {
                        //show errors
                        Task task = CheckQueryError(m_SelectedFileName, result.StringOutput, m_lastQuery);
                        if (task != null)
                        {
                            taskService.Add(task);
                        }
                    }
                }
                else
                {
                    applicationStatus.SetStatus("Query executed without result", false);
                    resultsService.ShowStringResult("There is no result...");
                }

                break;
            }
            m_SelectedFileName = null;
        }
Exemplo n.º 4
0
        private void ExecuteQueryCompleted(ExecuteQueryStatus status, IQueryResult result)
        {
            taskService.RemoveAll(task => (task.FileName == m_SelectedFileName && task.Line == m_SelectedLine));
            SetEnableCondition(true);
            switch (status)
            {
            case ExecuteQueryStatus.Canceled:
                applicationStatus.SetStatus("Query canceled", false);
                break;

            case ExecuteQueryStatus.Error:
                applicationStatus.SetStatus("Query failure", false);
                break;

            case ExecuteQueryStatus.Done:
            default:

                if (result != null)
                {
                    applicationStatus.SetStatus("Selected query executed", false);
                    resultsService.ShowStringResult(result.StringOutput);

                    try
                    {
                        string     refactoredResults = ExecuteQueryCommand.RefactorResults(result.StringOutput);
                        DataMatrix dm = ExecuteQueryCommand.CreateDataMatrix(refactoredResults);
                        resultsService.ShowDataResult(dm);
                    }
                    catch (XmlException)
                    {
                        //show errors
                        Task task = ExecuteQueryCommand.CheckQueryError(m_SelectedFileName, result.StringOutput, m_lastQuery, m_SelectedLine, m_SelectedColumn);
                        if (task != null)
                        {
                            taskService.Add(task);
                        }
                    }
                }
                break;
            }
            m_SelectedFileName = null;
            m_SelectedLine     = 0;
        }
Exemplo n.º 5
0
        private void GetSystemInfoCompleted(ExecuteQueryStatus status, SystemInfo systemInfo, IQueryResult queryResult)
        {
            if (queryResult != null)
            {
                switch (queryResult.QueryResultType)
                {
                case ResultType.StringResult:
                    resultsService.ShowStringResult(queryResult.StringOutput);
                    break;
                }
            }

            switch (status)
            {
            case ExecuteQueryStatus.Done:

                connectionService.DatabasesChanged += delegate(object s, EventArgs e)
                {
                    IConnectionService senderService = (IConnectionService)s;
                    solutionExplorer.TreeView.Root = treeLoader.load(senderService.SystemInfo);
                };

                CentralServerNode centralServerNode = treeLoader.load(systemInfo);
                solutionExplorer.TreeView.Root             = centralServerNode;
                solutionExplorer.TreeView.ShowRootExpander = true;
                applicationStatus.SetStatus("Connected", false);
                break;

            case ExecuteQueryStatus.Canceled:
                break;

            case ExecuteQueryStatus.Error:
                applicationStatus.SetStatus("Connection failure", false);
                break;

            default:
                break;
            }
        }
Exemplo n.º 6
0
        private void ExecuteQueryCompleted(ExecuteQueryStatus status, IQueryResult result)
        {
            SetEnableCondition(true);
            switch (status)
            {
            case ExecuteQueryStatus.Canceled:
                applicationStatus.SetStatus("Query canceled", false);
                break;

            case ExecuteQueryStatus.Error:
                applicationStatus.SetStatus("Query failure", false);
                break;

            case ExecuteQueryStatus.Done:
            default:
                taskService.RemoveAll(task => task.FileName == m_SelectedFileName);
                applicationStatus.SetStatus("Query executed", false);
                StringBuilder sb = new StringBuilder();
                if (result != null)
                {
                    bool focusOnGrid = false;

                    while (result != null)
                    {
                        try
                        {
                            string     refactoredResults = RefactorResults(result.StringOutput);
                            DataMatrix dm = CreateDataMatrix(refactoredResults);
                            resultsService.ShowDataResult(dm);
                            sb.AppendLine(string.Format("{0} objects affected", dm.Rows.Count));
                            focusOnGrid = true;
                        }
                        catch (Exception)
                        {
                            //show as string
                            sb.AppendLine(result.StringOutput);
                            //show references
                            if (result.QueryResultType == ResultType.ReferencesOnly)
                            {
                                int        id = 0;
                                DataMatrix dm = new DataMatrix();
                                dm.Columns.Add(new MatrixColumn()
                                {
                                    Name = "No"
                                });
                                dm.Columns.Add(new MatrixColumn()
                                {
                                    Name = "Oid"
                                });
                                result.QueryResults.ForEach(o => dm.Rows.Add(new object[] { ++id, o.Id }));
                                resultsService.ShowDataResult(dm);
                                sb.AppendLine(string.Format("{0} objects affected", id));
                                focusOnGrid = true;
                            }
                        }
                        result = result.NextResult;
                    }
                    resultsService.ShowStringResult(sb.ToString());
                    if (focusOnGrid)
                    {
                        resultsService.FocusOnDataResult();
                    }
                }
                else
                {
                    applicationStatus.SetStatus("Query executed without result", false);
                    resultsService.ShowStringResult("There is no result...");
                }

                break;
            }
            m_SelectedFileName = null;
        }