public TaggedAppointmentArray getAppointmentsFromSite(
string pwd, string sitecode, string mpiPid)
{
TaggedAppointmentArray result = new TaggedAppointmentArray();
if (String.IsNullOrEmpty(sitecode))
{
result.fault = new FaultTO("Missing sitecode");
}
else if (String.IsNullOrEmpty(mpiPid))
{
result.fault = new FaultTO("Missing mpiPid");
}
if (result.fault != null)
{
return result;
}
AccountLib acctLib = new AccountLib(mySession);
try
{
SiteArray sites = acctLib.patientVisit(pwd, sitecode, mpiPid, false);
if (sites.fault != null)
{
result.fault = sites.fault;
return result;
}
// Get the labs...
EncounterApi api = new EncounterApi();
Appointment[] appts = api.getAppointments(mySession.ConnectionSet.getConnection(sitecode));
for (int i = 0; i < appts.Length; i++)
{
appts[i].Status = undecodeApptStatus(appts[i].Status);
}
result = new TaggedAppointmentArray(sitecode, appts);
}
catch (Exception e)
{
result.fault = new FaultTO(e.Message);
}
finally
{
mySession.close();
}
return result;
}