public PreviewPane(string fsId, QueryMode mode, ClassDefinition cls, IEditorService edSvc, IFdoProviderCapabilities caps)
            : this()
        {
            _fsId    = fsId;
            _mode    = mode;
            _cls     = cls;
            _featSvc = edSvc.CurrentConnection.FeatureService;

            IQueryControl ctrl = null;

            switch (_mode)
            {
            case QueryMode.SQL:
                ctrl   = new SqlQueryCtrl(fsId, edSvc);
                _inner = ctrl;
                break;

            case QueryMode.Standard:
                ctrl   = new StandardQueryCtrl(fsId, edSvc, cls, caps);
                _inner = ctrl;
                break;
            }

            if (ctrl == null)
            {
                throw new ArgumentException(Strings.UnknownQueryMode);
            }

            ctrl.Content.Dock = DockStyle.Fill;
            queryPane.Controls.Add(ctrl.Content);
        }
示例#2
0
        public PreviewPane(string fsId, QueryMode mode, ClassDefinition cls, IFeatureService featSvc, FdoProviderCapabilities caps)
            : this()
        {
            _fsId = fsId;
            _mode = mode;
            _cls = cls;
            _featSvc = featSvc;

            IQueryControl ctrl = null;
            switch (_mode)
            {
                case QueryMode.SQL:
                    ctrl = new SqlQueryCtrl(fsId, featSvc);
                    _inner = ctrl;
                    break;
                case QueryMode.Standard:
                    ctrl = new StandardQueryCtrl(fsId, featSvc, cls, caps);
                    _inner = ctrl;
                    break;
            }

            if (ctrl == null)
            {
                throw new ArgumentException(Strings.UnknownQueryMode);
            }

            ctrl.Content.Dock = DockStyle.Fill;
            queryPane.Controls.Add(ctrl.Content);
        }
示例#3
0
        private IQueryControl GetQueryControl()
        {
            IQueryControl retv = null;

            foreach (Control c in splitContainer2.Panel1.Controls)
            {
                if (c is IQueryControl)
                {
                    retv = (IQueryControl)c;
                    break;
                }
            }
            return(retv);
        }
示例#4
0
        private void executeQuery(string cmd)
        {
            IQueryControl qc = GetQueryControl();

            if (qc == null)
            {
                MessageBox.Show("Not a valid query control available");
            }
            else
            {
                TimeSpan timer = new TimeSpan();
                try
                {
                    DataSet queryResults = qc.ExecuteQuery((EDtxReaderType)readerTypeCombo.SelectedItem, (int)timeout.Value, cmd, setupQueryControl1.Parameters, ref timer);
                    cmd = cmd.ToLower().TrimEnd(TrimUs);
                    if (queryHistoryLB.Items.Contains(cmd) == false)
                    {
                        queryHistoryLB.Items.Insert(0, cmd); //always insert as first
                    }
                    else //Item is already in list.  Move to first
                    {
                        queryHistoryLB.Items.Remove(cmd);
                        queryHistoryLB.Items.Insert(0, cmd);
                    }
                    SaveQueryInfo();
                    if (Results != null)
                    {
                        Results.SourceData = queryResults;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace);
                }
            }
        }