private ITable SetNonSpatialTable(string tableName)
{
try
{
//get map server
IMapServer3 mapServer = (IMapServer3)serverObjectHelper.ServerObject;
//get default map name
string mapName = mapServer.DefaultMapName;
//get map server info
IMapServerInfo3 pMapSrverInfo = mapServer.GetServerInfo(mapName) as IMapServerInfo3;
//get standalone table info collection
IStandaloneTableInfos pStandaloneTblInfos = pMapSrverInfo.StandaloneTableInfos;
int? tableID = null;
//get the ID of the desired table
for (int i = 0; i < pStandaloneTblInfos.Count; i++)
{
IStandaloneTableInfo pStandaloneTblInfo = pStandaloneTblInfos.get_Element(i);
//if the name matches, then set table ID
if (pStandaloneTblInfo.Name.ToUpper() == tableName.ToUpper())
{
tableID = pStandaloneTblInfo.ID;
}
}
//get map server object
IMapServerObjects3 pMapServerObj = serverObjectHelper.ServerObject as IMapServerObjects3;
if (tableID != null)
{
ITable pTable = pMapServerObj.get_StandaloneTable(mapName, Convert.ToInt16(tableID));
return pTable;
}
return null;
}
catch (Exception ex)
{
string errMsg = "An Error occured in the SOE method - SetNonSpatialTable - " + " " + "Error : " + ex.Message
+ "Stack Trace : " + " " + ex.StackTrace;
logger.LogMessage(ServerLogger.msgType.error, "SetNonSpatialTable", 400, errMsg);
return null;
}
}
...
[LEFT]IMapServer3 mapServer = serverObjectHelper.ServerObject as IMapServer3;
IStandaloneTableInfos satInfos = _MapServerInfo.StandaloneTableInfos;
IStandaloneTableInfo satInfo;
string myTableName;
for (int i = 0; i < satInfos.Count; i++)
{[INDENT]satInfo = satInfos.get_Element(i);
if (myTableName.Equals(satInfo.Name, StringComparison.InvariantCultureIgnoreCase) == true)
{
[INDENT]ITable myTable = setNonSpatialTable(mapServer.DefaultMapName, i);
break;[/INDENT]}[/INDENT]}
...
private ITable setNonSpatialTable(string mapName, int tablei)
{
[INDENT]if (tablei != null)
{
[INDENT]tablei = tablei + _MapServerInfo.MapLayerInfos.Count; //Tables listed after layers
ITable outTable = (ITable)_MapServerDataAccess.GetDataSource(mapName, tablei);
return outTable;[/INDENT]}
return null;[/INDENT]}
...[/LEFT]