示例#1
0
        private void ShowTableAttributes(Hubble.Framework.Data.DataTable table)
        {
            foreach (Hubble.Framework.Data.DataRow row in table.Rows)
            {
                AttributeCtrl ctrl;
                if (_TableInfoControlDict.TryGetValue(row["Attribute"].ToString(), out ctrl))
                {
                    if (ctrl.Ctrl is NumericUpDown)
                    {
                        (ctrl.Ctrl as NumericUpDown).Value = long.Parse(row["Value"].ToString());

                        ctrl.OriginalValue = (ctrl.Ctrl as NumericUpDown).Value.ToString();
                    }
                    else
                    {
                        ctrl.Ctrl.Text     = row["Value"].ToString();
                        ctrl.OriginalValue = ctrl.Ctrl.Text;
                    }
                }
            }

            if (comboBoxIndexOnly.Text.Trim().Equals("True", StringComparison.CurrentCultureIgnoreCase))
            {
                comboBoxTableSynchronization.Enabled = true;
            }
            else
            {
                comboBoxTableSynchronization.Enabled = false;
            }

            if (textBoxDocId.Text != "" && comboBoxTableSynchronization.Text.Equals("True", StringComparison.CurrentCultureIgnoreCase))
            {
                textBoxTriggerTableName.Enabled = true;
            }
            else
            {
                textBoxTriggerTableName.Enabled = false;
            }
        }
示例#2
0
        private void toolStripButtonExcute_Click(object sender, EventArgs e)
        {
            try
            {
                toolStripStatusLabelReport.Text = "";

                tabControl1.SelectedTab = tabPageResults;
                textBoxMessages.Text    = "";

                QueryPerfCounter qp = new QueryPerfCounter();
                qp.Start();

                int count = 0;

                SFQLParse sfqlParse = new SFQLParse();
                string    sql       = textBoxSql.Text;

                if (!string.IsNullOrEmpty(textBoxSql.SelectedText))
                {
                    sql = textBoxSql.SelectedText;
                }

                if (sql.StartsWith("SP_", StringComparison.CurrentCultureIgnoreCase))
                {
                    sql = "exec " + sql;
                }

                if (performanceReportToolStripMenuItem.Checked)
                {
                    sql = "[PerformanceReport]\r\n" + sql;
                }

                QueryResult queryResult;

                GlobalSetting.DataAccess.ResetDataCacheAfterTimeout =
                    resetDataCacheAfterTimeoutToolStripMenuItem.Checked;

                if (dataCacheToolStripMenuItem.Checked)
                {
                    queryResult = GlobalSetting.DataAccess.Excute(sql, 0);
                }
                else
                {
                    queryResult = GlobalSetting.DataAccess.Excute(sql);
                }

                Hubble.Framework.Data.DataTable table = null;

                if (queryResult.DataSet.Tables.Count > 0)
                {
                    table = queryResult.DataSet.Tables[0];
                    count = table.MinimumCapacity;
                }

                qp.Stop();
                double ns = qp.Duration(1);

                StringBuilder report = new StringBuilder();

                report.AppendFormat("Duration:{0} ", (ns / (1000 * 1000)).ToString("0.00") + " ms");
                report.AppendFormat("Count={0}", count);

                if (queryResult.PrintMessages != null)
                {
                    if (queryResult.PrintMessageCount > 0)
                    {
                        ShowMessages(queryResult.PrintMessages, table == null);
                    }
                }

                MultiGridView mulitGridView = new MultiGridView(panelResult, queryResult.DataSet.Tables.Count);

                for (int i = 0; i < queryResult.DataSet.Tables.Count; i++)
                {
                    queryResult.DataSet.Tables[i].MinimumCapacity = 0;
                    mulitGridView.GridViewList[i].DataSource      = queryResult.DataSet.Tables[i].ConvertToSystemDataTable();

                    DataTable tbl = queryResult.DataSet.Tables[i];

                    for (int j = 0; j < tbl.Columns.Count; j++)
                    {
                        if (tbl.Columns[j].DataType == typeof(DateTime))
                        {
                            mulitGridView.GridViewList[i].Columns[j].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:sss";
                        }
                    }
                }

                toolStripStatusLabelReport.Text = report.ToString();

                if (performanceReportToolStripMenuItem.Checked)
                {
                    tabControl1.SelectedTab = tabPageMessages;
                }
            }
            catch (Hubble.Core.SFQL.LexicalAnalysis.LexicalException lexicalEx)
            {
                ShowErrorMessage(lexicalEx.ToString());
            }
            catch (Hubble.Core.SFQL.SyntaxAnalysis.SyntaxException syntaxEx)
            {
                ShowErrorMessage(syntaxEx.ToString());
            }
            catch (Hubble.Framework.Net.ServerException e1)
            {
                ShowErrorMessage(e1.Message + "\r\n" + e1.StackTrace);
            }
            catch (Exception e1)
            {
                ShowErrorMessage(e1.Message + "\r\n" + e1.StackTrace);
            }
            finally
            {
            }

            textBoxSql.Focus();
        }