Walaa wrote:
public PaymentCollection ClaPayment = new PaymentCollection();
ClaPayment.GetMulti(null);
Why do you call getMulti here? it will fetch the entire table without filtering.
PredicateExpression JobFilter = new PredicateExpression();
IPredicateExpression filter = new PredicateExpression();
Why do you use 2 predicate expressions, no need for that.
filter.Add(new FieldLikePredicate(PaymentFields.PaidBy, "%" + txtSearch.Text + "%"));
As Daelmo said, you should filter on the fields of the User table, and use a relation between both entities.
Your code should look like the following: (not tested).
public PaymentCollection ClaPayment = new PaymentCollection();
IPredicateExpression filter = new PredicateExpression();
filter.Add(new FieldLikePredicate(UserFields.FirstName, "%" + txtSearch.Text + "%"));
filter.AddWithOr(new FieldLikePredicate(UserFields.LastName, "%" + txtSearch.Text + "%"));
IRelationCollection relations = new RelationCollection();
relations.Add(PaymentEntity.Relations.UserEntityUsingPaidBy); // not sure about the relation name, intellisense should guide you.
ClaPayment.GetMulti(JobFilter, relations);
gvCreditCardPayment.DataSource = ClaPayment;
gvCreditCardPayment.DataBind();
hi walaa,
thanks for such good guild line.My Database is MySQL, well i have review your code, i understand entire code but i dont understand one thing is that
relations.Add(PaymentEntity.Relations.UserEntityUsingPaidBy); // not sure about the relation name, intellisense should guide you.
when i put dot(.) after relations word i can get only following property
Equal
GetAllRelation
getHasCode
getSubtyperelation
GetSuperTypeRelation
GetType
ToString
not any replation between table. how to do that ?? and i dont understand your comment "not sure about the relation name, intellisense should guide you."
Please help me for this problem