Searching

Posts   
 
    
Skeeterbug
User
Posts: 165
Joined: 21-May-2004
# Posted on: 18-Feb-2005 19:28:05   

Hey All!

I was just curious to see what others have done for searching with LLBLGen. I am using adapter. I am currently working on a search function that looks like this:


public int [] Search(string partNumber, string description,
            string vendor, DateTime invoiceDate, string invoiceNumber,
            decimal qty, decimal invoiceTotal, decimal totalPerUnit)
{
    IPredicateExpression exp = new PredicateExpression();
    if(partNumber != null)
    {
        if(exp.Count < 1)
            exp.Add(PredicateFactory.Like(PartFieldIndex.PartNumber,partNumber));
    }
    if(description != null)
    {
        if(exp.Count < 1)
        {
            exp.Add(PredicateFactory.Like(PartFieldIndex.Description,description));
        }
        else
        {
            exp.AddWithOr(PredicateFactory.Like(PartFieldIndex.Description,description));
        }   
    }

    
//validate rest of search fields


}



Has anyone else just used if statements to build up your expression? If not, what do you do? Thanks.