TSF.UmlToolingFramework.Wrappers.EA.Model.getQuickSearchResults C# (CSharp) Method

getQuickSearchResults() public method

returns the first [maxresults] items who's name starts with the given searchText
public getQuickSearchResults ( string searchText, int maxResults, bool elements, bool operations, bool attributes, bool diagrams ) : List
searchText string the first part of the name to match
maxResults int the number of results required
elements bool indicates whether elements should be selected
operations bool indicates whether operations should be selected
attributes bool indicates whether attributes should be selected
diagrams bool indicates whether diagrams should be selected
return List
        public List<UML.Extended.UMLItem> getQuickSearchResults(string searchText,int maxResults,bool elements, bool operations, bool attributes, bool diagrams)
        {
            List<UML.Extended.UMLItem> results = new List<UML.Extended.UMLItem>();
            if (elements)
            {
            // get elements
             		string SQLSelectElements = @"select top "+maxResults + @" o.Object_ID from t_object o
                                where lcase(o.Name) like lcase('" +searchText +@"%')
                                order by o.Name, o.Object_ID";
             		results.AddRange(this.getElementWrappersByQuery(SQLSelectElements).Cast<UML.Extended.UMLItem>().ToList());
            }
            if (operations)
            {
             		// get operations
             		string SQLSelectOperations = @"select top "+maxResults + @" o.OperationID from t_operation o
                                where lcase(o.Name) like lcase('" +searchText +@"%')
                                order by o.Name, o.OperationID";
             		results.AddRange(this.getOperationsByQuery(SQLSelectOperations).Cast<UML.Extended.UMLItem>().ToList());
            }
            if (attributes)
            {
             		// get attributes
             	string SQLSelectAttributes = @"select top "+maxResults + @" a.ea_guid from t_attribute a
                            where lcase(a.Name) like lcase('" +searchText +@"%')
                            order by a.Name, a.ea_guid";
             		results.AddRange(this.getAttributesByQuery(SQLSelectAttributes).Cast<UML.Extended.UMLItem>().ToList());
            }
            if (diagrams)
            {
             		// get diagrams
             		string SQLSelectDiagrams = @"select top "+maxResults + @" d.Diagram_ID from t_diagram d
                            where  lcase(d.Name) like lcase('" +searchText +@"%')
                            order by d.Name, d.Diagram_ID";
             		results.AddRange(this.getDiagramsByQuery(SQLSelectDiagrams).Cast<UML.Extended.UMLItem>().ToList());
            }

             		//sort alphabetically by name
             		results = results.OrderBy(x => x.name).ToList();

             		//we need only the first maxresults
             		if (results.Count > maxResults)
             		{
             			results = results.GetRange(0,maxResults);
             		}
             		return results;
        }