How do you get Pid value from _PersonCollection?
What I have throws an error.
// Get the preferences from the AppUserPreferences table
IRelationPredicateBucket filter = new RelationPredicateBucket();
filter.PredicateExpression.Add( PredicateFactory.CompareValue( PersonFieldIndex.Pid, ComparisonOperator.Equal, u.Pid ) );
adapter.FetchEntityCollection(_PersonCollection, filter);
if(_PersonCollection.Count == 0)
{
throw new ApplicationException( "Pid is not valid for currently logged on user");
}
else if(_PersonCollection.Count > 1)
{
throw new ApplicationException( "Pid returned more than one value for currently logged on user");
}
else
{
//Result only returned 1
FromId = Convert.ToInt32(_PersonCollection.Items[0]);
}