public void loadPoi(WebBrowser webBrowser, Poi poi) { if (webBrowser != null) { htmlDocument = (mshtml.IHTMLDocument3)webBrowser.Document; mshtml.IHTMLElementCollection collection = htmlDocument.getElementsByName("formPoi"); foreach (mshtml.HTMLInputElement element in collection.item(name: "formPoi")) { if (element.id == "poiId") { element.value = poi.Id.ToString(); } if (element.id == "poiLatitude") { element.value = poi.Coordinate.latitude.ToString(); } if (element.id == "poiLongitude") { element.value = poi.Coordinate.longitude.ToString(); } if (element.id == "poiName") { element.value = poi.Name; } if (element.id == "poiDescription") { element.value = poi.Description; } if (element.id == "poiIcon") { element.value = poi.Image; } if (element.id == "poiSubmit") { mshtml.HTMLInputElement btnSubmit = element; btnSubmit.click(); } } } }
public void fillPois (Company company) { foreach (User user in company.Users) { ConcurrentQueue<Poi> pois = new ConcurrentQueue<Poi>(); try { mysqlConnection = new MySqlConnection(database.getConnectionString()); mysqlConnection.Open(); string sql = "SELECT * " + "FROM cmp_" + company.DatabaseName + ".poi_" + user.DatabaseName + ";"; MySqlCommand mySqlCommand = new MySqlCommand(sql, mysqlConnection); MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader(); if (!mySqlDataReader.HasRows) { mySqlDataReader.Dispose(); } else { while (mySqlDataReader.Read()) { Poi poi = new Poi(); poi.Id = mySqlDataReader.GetInt32("poi_id"); poi.Name = mySqlDataReader.GetString("poi_name"); poi.Description = mySqlDataReader.GetString("poi_desc"); poi.Image = mySqlDataReader.GetString("poi_img"); string poiLatitude = mySqlDataReader.GetString("poi_lat"); string potLongitude = mySqlDataReader.GetString("poi_lon"); if (String.IsNullOrEmpty(poiLatitude) || String.IsNullOrEmpty(potLongitude)) { poi.Coordinate = new Coordinate(0.0f, 0.0f); } else { poi.Coordinate = new Coordinate(double.Parse(poiLatitude), double.Parse(potLongitude)); } //if (!String.IsNullOrEmpty(poiLatitude) || !String.IsNullOrEmpty(potLongitude)) { // poi.Coordinate = new Coordinate( // double.Parse(poiLatitude), // double.Parse(potLongitude) // ); //} pois.Enqueue(poi); } user.Pois = pois; mySqlDataReader.Dispose(); } } catch (MySqlException mySqlException) { throw new QueryException(1, mySqlException.Message); } catch (QueryException queryException) { throw queryException; } catch (Exception exception) { throw new QueryException(1, exception.Message); } finally { mysqlConnection.Close(); } } }