/// <summary>
/// Visit multiple data sources after a login.
/// </summary>
/// <remarks>
/// Requires a previous login so the credentials are already in mySession and are
/// not altered. Can visit a single source or multiple sources. Sources may be
/// VAMCs, VISNs, some combination of VAMCs and VISNs, or the entire VHA. See the
/// sourceList parameter.
/// </remarks>
/// <param name="pwd">Client app's BSE security phrase</param>
/// <param name="sourceList">
/// A comma-delimited list of station numbers and/or VISN IDs, as in
/// "402,550" or "V12,V22" or "V1,V2,456". To visit all VistA systems set the param
/// to "*". Duplicate station #'s are ignored.
/// </param>
/// <param name="permissionString">If blank defaults to CPRS context</param>
/// <returns>TaggedTextArray: each site with user DUZ or an error message</returns>
public TaggedTextArray visitSites(string pwd, string sourceList, string permissionString)
{
TaggedTextArray result = new TaggedTextArray();
//Say the magic word
// TBD - needed?????
//if (pwd != mySession.AppPwd)
//{
// result.fault = new FaultTO("Invalid application password");
//}
if (mySession == null || mySession.SiteTable == null)
{
result.fault = new FaultTO("No site table");
}
else if (sourceList == "")
{
result.fault = new FaultTO("Missing sitelist");
}
//else if (mySession.user == null)
//{
// result.fault = new FaultTO("No logged in user");
//}
else if (mySession.Credentials == null)
{
result.fault = new FaultTO("Cannot use this method without previous login");
}
if (result.fault != null)
{
return(result);
}
Site[] sites = MdwsUtils.parseSiteList(mySession.SiteTable, sourceList);
List <DataSource> sources = new List <DataSource>(sites.Length);
for (int i = 0; i < sites.Length; i++)
{
for (int j = 0; j < sites[i].Sources.Length; j++)
{
if (sites[i].Sources[j].Protocol == "VISTA" ||
sites[i].Sources[j].Protocol == "FHIE" || sites[i].Sources[j].Protocol == "XVISTA")
{
sources.Add(sites[i].Sources[j]);
}
}
}
return(setupMultiSourceQuery(pwd, sources, permissionString));
}