I have gotten this far now. I just need to figure out how to deal with these two problems I get
public void FetchMembers(MemberQuery q)
{
List<Expression<Func<Member, bool>>> expressions = new List<Expression<Func<Member, bool>>>();
if(q.SSN != string.Empty)
expressions.Add(PredicateBuilder.Make(typeof(Member), "SocSecNo", FilterOperator.IsEqualTo, q.SSN));
if(q.CardNo != 0)
expressions.Add(PredicateBuilder.Make(typeof(Member), "CardNo", FilterOperator.IsEqualTo, q.CardNo));
if(q.EmployeeNo != string.Empty)
expressions.Add(PredicateBuilder.Make(typeof(Member), "EmployeeNo", FilterOperator.IsEqualTo, q.EmployeeNo));
if(q.LastName != string.Empty)
expressions.Add(PredicateBuilder.Make(typeof(Member), "LastName", FilterOperator.IsEqualTo, q.LastName));
if(q.FirstName != string.Empty)
expressions.Add(PredicateBuilder.Make(typeof(Member), "FirstName", FilterOperator.IsEqualTo, q.FirstName));
var newExpr = PredicateBuilder.And(expressions.ToArray());
var query = PredicateBuilder.FilterQuery(entityManager.Members, newExpr);
var results = query.Execute<Member>();
results.ForEach(Members.Add);
}
I am getting two made errors they prefer to each add line.
Error 1 The best overloaded method match for 'System.Collections.Generic.List<System.Linq.Expressions.Expression<System.Func<DomainModel.Member,bool>>>.Add(System.Linq.Expressions.Expression<System.Func<DomainModel.Member,bool>>)' has some invalid arguments D:\Software Development\VS2010\TicketWare2010\TicketWare2010\Models\MemberViewModel.cs 67 18 TicketWare2010
Error 2 Argument 1: cannot convert from 'IdeaBlade.Linq.PredicateDescription' to 'System.Linq.Expressions.Expression<System.Func<DomainModel.Member,bool>>' D:\Software Development\VS2010\TicketWare2010\TicketWare2010\Models\MemberViewModel.cs 67 34 TicketWare2010