internal TaggedPatientArray match(AbstractConnection cxn, string target)
{
TaggedPatientArray result = new TaggedPatientArray();
if (!cxn.IsConnected)
{
result = new TaggedPatientArray("Connection not open");
}
else if (cxn.DataSource.Uid == "")
{
result = new TaggedPatientArray("No user authorized for lookup");
}
else if (target == "")
{
result.fault = new FaultTO("Missing target");
}
if (result.fault != null)
{
return result;
}
try
{
PatientApi patientApi = new PatientApi();
Patient[] matches = patientApi.match(cxn, target);
result = new TaggedPatientArray(cxn.DataSource.SiteId.Id, matches);
}
catch (Exception e)
{
result.fault = new FaultTO(e.Message);
}
return result;
}