Beispiel #1
0
        /// <summary>
        /// Searches the database.
        /// </summary>
        private void Search()
        {
            if (SqlSearcher.AreTermsValid(this.comboSearchFor.Text))
            {
                // create...
                SqlSearcher searcher = new SqlSearcher(this.EntityType, this.comboSearchFor.Text);
                IList       results  = searcher.ExecuteEntityCollection();
                if (results == null)
                {
                    throw new InvalidOperationException("results is null.");
                }

                // show...
                if (this.ViewExpressions.Count == 0)
                {
                    this.listResults.DataSource = results;
                }
                else
                {
                    this.listResults.DataSource = new EntityViewCollection(this.EntityType, results, (object[])this.ViewExpressions.ToArray(typeof(object)));
                }

                // set...
                this.MruItems.Push(this.comboSearchFor.Text);
                this.RefreshMruItems();

                // ok...
                this.OnSearchCompleted();
            }
            else
            {
                Alert.ShowWarning(this, "The search terms you specified are invalid.");
            }
        }
        private void Init(string connString)
        {
            Lexicon     lex      = new Lexicon(new SqlLexicon(connString));
            SqlSearcher provider = new SqlSearcher(connString);

            searcher = new Searcher(lex, provider);
        }
 private void Init(string connString)        
 {
     Lexicon lex = new Lexicon(new SqlLexicon(connString));
     SqlSearcher provider = new SqlSearcher(connString);
     searcher = new Searcher(lex, provider);
 }