Esempio n. 1
0
        private void search()
        {
            string searchArea           = _view.cboSearchAreaType.Text;
            string searchCriteria       = _view.txtSearchArea.Text;
            bool   caseSensitive        = _view.chkCaseSensitive.Checked;
            bool   exactMatch           = _view.chkExactMatch.Checked;
            bool   includeSystemObjects = _view.chkIncludeSystemObjects.Checked;

            ServerNode   sn  = MainPresenter.Instance.GetServerNode();
            DatabaseNode dbn = MainPresenter.Instance.GetDatabaseNode();


            if (sn != null)
            {
                Sql8rServer   s  = sn.ServerObject;
                Sql8rDatabase db = null;
                if (dbn != null)
                {
                    db = dbn.DatabaseObject;
                }

                var            factory = SearchManagerFactory.Instance;
                ISearchManager man     = factory.GetDomainSearchManager();

                _view.grdResults.DataSource = null;
                if (searchArea == SearchAreas.Table)
                {
                    _view.grdResults.DataSource = man.SearchAllTables(s, db, searchCriteria, exactMatch, caseSensitive, includeSystemObjects);
                }
                else if (searchArea == SearchAreas.View)
                {
                    _view.grdResults.DataSource = man.SearchAllViews(s, db, searchCriteria, exactMatch, caseSensitive, includeSystemObjects);
                }

                if (_view.grdResults.DisplayLayout.Bands.Count > 0)
                {
                    autoSizeAllColumns(_view.grdResults.DisplayLayout.Bands[0]);
                }
            }
            else
            {
                MainPresenter.Instance.SetError("No active connection");
            }
        }