internal TaggedTextArray setupMultiSourceQuery(string pwd, List<DataSource> sources, string context)
{
TaggedTextArray result = new TaggedTextArray();
if (sources == null || sources.Count == 0)
{
result.fault = new FaultTO("No sources");
}
else if (mySession.SiteTable == null)
{
result.fault = new FaultTO("No site table");
}
else if (mySession.Credentials == null)
{
result.fault = new FaultTO("No credentials", "Need to login?");
}
if (result.fault != null)
{
return result;
}
if (String.IsNullOrEmpty(context))
{
context = mySession.DefaultPermissionString;
}
if (mySession.PrimaryPermission == null || String.IsNullOrEmpty(mySession.PrimaryPermission.Name))
{
mySession.PrimaryPermission = new MenuOption(context);
}
try
{
mySession.ConnectionSet.ExcludeSite200 = mySession._excludeSite200;
mySession.ConnectionSet.Add(sources, mySession.DefaultVisitMethod);
mySession.Credentials.SecurityPhrase = pwd;
DataSource validator = new DataSource() { ConnectionString = mySession.MdwsConfiguration.BseValidatorConnectionString };
IndexedHashtable t = mySession.ConnectionSet.connect(mySession.Credentials, mySession.PrimaryPermission, validator);
if (t.Count == 0)
{
throw new Exception("Unable to connect to remote sites");
}
result = new TaggedTextArray(t);
}
catch (Exception e)
{
result = new TaggedTextArray();
result.fault = new FaultTO(e.Message);
}
return result;
}