Пример #1
0
  private static CommonHost GetHost(Configuration.MapTabRow mapTab, string type)
  {
    string userName = mapTab.IsUserNameNull() ? "" : mapTab.UserName;
    string password = mapTab.IsPasswordNull() ? "" : mapTab.Password;

    CommonHost host = null;
    
    try
    {
      switch (type)
      {
        case "AGS":
          if (String.IsNullOrEmpty(userName) && String.IsNullOrEmpty(password))
          {
            host = new AgsHost(mapTab.MapHost);
          }
          else
          {
            try
            {
              host = new AgsHost(mapTab.MapHost, userName, password, true);
            }
            catch { }

            if (host == null)
            {
              host = new AgsHost(mapTab.MapHost, userName, password, false);
            }
          }
          break;

        case "ArcIMS": 
          host = new ArcImsHost(mapTab.MapHost, userName, password); 
          break;
      }
    }
    catch { }

    return host;
  }