public JupiterDatabase(MediatorDatabase mediatorDatabase) : base(mediatorDatabase) { BasicHttpBinding basicHttpBinding = new BasicHttpBinding(); basicHttpBinding.MaxReceivedMessageSize = 99999999; basicHttpBinding.MaxBufferSize = 99999999; basicHttpBinding.MaxBufferPoolSize = 99999999; this.jupiterClient = new JupiterConnectionServiceClient(basicHttpBinding, new EndpointAddress(JUPITER_WEBSERVICE_URL)); }
void Start() { mediatorDatabase = new MediatorDatabase(); StartCoroutine(initializeMediatorsLists()); StartCoroutine(testDatabases()); /* * Debug.Log("Creating connection!"); * jupiterClient = new JupiterReadClient(new BasicHttpBinding(), * new EndpointAddress("http://geusjuptest.geus.dk:80/jupiter.read.1.2.0/jupiterread.svc")); * Debug.Log("Connection made!"); * * String sql = "SELECT * FROM CODE WHERE CODETYPE = 47"; * jupiterClient.select(sql); * //Console.Out.WriteLine(sql); * //selectFromDatabase(sql); */ }
public GeoGisDatabase(MediatorDatabase mediatorDatabase) { this.mediatorDatabase = mediatorDatabase; client = new Service(GEOGIS_WEBSERVICE_URL); }
public ProxyDatabase(MediatorDatabase mediatorDatabase) { this.mediatorDatabase = mediatorDatabase; this.id = mediatorDatabase.getNewId(); }
public List <Borehole> getBoreholes(Location currentLocation, double radius) { Debug.Log("Jupiter - Henter boringer"); List <Borehole> boreholes = null; SelectResult selectResult = null; try { String sql = "SELECT BOREHOLENO, LATITUDE, LONGITUDE, ELEVATION, ZDVR90, PURPOSE, LOCATQUALI, LOCATMETHO FROM BOREHOLE" + " WHERE LATITUDE >= " + (currentLocation.X - radius).ToString(CultureInfo.InvariantCulture) + " AND LATITUDE <= " + (currentLocation.X + radius).ToString(CultureInfo.InvariantCulture) + " AND LONGITUDE >= " + (currentLocation.Y - radius).ToString(CultureInfo.InvariantCulture) + " AND LONGITUDE <= " + (currentLocation.Y + radius).ToString(CultureInfo.InvariantCulture); Debug.Log("Jupiter Boringer SQL: " + sql); selectResult = jupiterClient.select(sql); } catch (System.ServiceModel.CommunicationException e) { Debug.Log("Exception: Too Many Results"); return(null); } catch (System.Net.WebException e) { Debug.Log("Exception: Jupiter Connection Service not available"); return(null); } catch (Exception e) { Debug.Log("Exception: Unknown"); } if (selectResult != null) { if (selectResult.DataSetResult != null) { foreach (DataTable table in selectResult.DataSetResult.Tables) { String[] columnNames = new String[table.Columns.Count]; for (int i = 0; i < table.Columns.Count; i++) { columnNames[i] = table.Columns[i].ColumnName; } boreholes = new List <Borehole>(); foreach (System.Data.DataRow row in table.Rows) { object[] itemArray = row.ItemArray; Borehole borehole = new Borehole(); float? latitude = null; float? longitude = null; String locationQuality_Code = null; String locationMethod_Code = null; for (int i = 0; i < itemArray.Length; i++) { if (!(itemArray[i] is DBNull)) { switch (columnNames[i]) { case "BOREHOLENO": borehole.BoreholeNo = Convert.ToString(itemArray[i]); break; case "LATITUDE": latitude = Convert.ToSingle(itemArray[i], new CultureInfo("da-DK")); break; case "LONGITUDE": longitude = Convert.ToSingle(itemArray[i], new CultureInfo("da-DK")); break; case "ELEVATION": borehole.ReferencePoint = Convert.ToSingle(itemArray[i], new CultureInfo("da-DK")); break; case "ZDVR90": borehole.ReferencePointKote = Convert.ToSingle(itemArray[i], new CultureInfo("da-DK")); break; case "PURPOSE": borehole.BoreholeType = MediatorDatabase.getBoreholeType(Convert.ToString(itemArray[i])); break; case "LOCATQUALI": locationQuality_Code = Convert.ToString(itemArray[i]); break; case "LOCATMETHO": locationMethod_Code = Convert.ToString(itemArray[i]); break; default: Debug.Log("Unidentified Column!"); break; } } } if (latitude != null && longitude != null) { borehole.Location = new Location((float)latitude, (float)longitude); if (locationQuality_Code != null) { borehole.Location.LocationQuality = MediatorDatabase.getLocationQuality(locationQuality_Code); } if (locationMethod_Code != null) { borehole.Location.LocationMethod = MediatorDatabase.getLocationMethod(locationMethod_Code); } } if (borehole.BoreholeNo != null) { borehole.Screens = getScreens(borehole.BoreholeNo); } boreholes.Add(borehole); } } } else { Debug.Log("DataSetResult is null"); } if (selectResult.Error != null) { Debug.Log("Error getting Boreholes. " + selectResult.Error); } } else { Debug.Log("SelectResult is null"); } return(boreholes); }