I have the following code which use to filter the record based on the search criteria. What i wondering, is that possible i used the GetProjectData() to filter record for GetPersonData. Please advise, thank you
private EntityCollection<PersonResponsibleEntity> GetPersonData()
{
EntityCollection<PersonResponsibleEntity> collection = new EntityCollection<PersonResponsibleEntity>();
DataAccessAdapter aAdaptor = clsDatabaseMethods.GetNewAdapter();
IPrefetchPath2 path = new PrefetchPath2(EntityType.PersonResponsibleEntity);
RelationPredicateBucket bucketbucket = new RelationPredicateBucket();
aAdaptor.FetchEntityCollection(collection, bucketbucket);
return collection;
}
private EntityCollection<VwProjectCollectionEntity> GetProjectData()
{
EntityCollection<VwProjectCollectionEntity> collection = new EntityCollection<VwProjectCollectionEntity>();
DataAccessAdapter aAdaptor = clsDatabaseMethods.GetNewAdapter();
IPrefetchPath2 path = new PrefetchPath2(EntityType.VwProjectCollectionEntity);
RelationPredicateBucket bucketbucket = new RelationPredicateBucket();
//The following will check if the Show Completed only checkbox is checked or not
if (chkShowCompleted.Checked)
{
bucketbucket.PredicateExpression.Add(VwProjectCollectionFields.DateCompleted != System.DBNull.Value);
}
else
{
bucketbucket.PredicateExpression.Add(VwProjectCollectionFields.DateCompleted == System.DBNull.Value);
}
//Add in predicate from search criteria
if (bucket != null)
{
Int32 count = 0;
while (count < bucket.Count)
{
bucketbucket.PredicateExpression.Add(bucket[count]);
count += 1;
}
}
SortExpression sort = new SortExpression();
//Sorting by LastName
ISortExpression aSortExpression = new SortExpression(VwProjectCollectionFields.LastName | SortOperator.Ascending);
//Using the StartDateOrder to make sure CommunicateionStartDate order ASC and put the null date in buttom
aSortExpression.Add(VwProjectCollectionFields.StartDateOrder | SortOperator.Ascending);
aSortExpression.Add(VwProjectCollectionFields.CommunicationStartDate | SortOperator.Ascending);
aAdaptor.FetchEntityCollection(collection, bucketbucket, 0, aSortExpression, path);
return collection;
}