public async Task <GeocodedAddress> GetById(int id) { using (SqlConnection sqlConnec = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("GetAddressById", sqlConnec)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@id", id)); GeocodedAddress address = null; await sqlConnec.OpenAsync(); using (var reader = await cmd.ExecuteReaderAsync()) { if (await reader.ReadAsync()) { address = MapToGeocodedAddress(reader); } else { address = new GeocodedAddress() { State = "PROCESANDO" }; } } return(address); } } }
public async Task InsertCoordinates(GeocodedAddress geocodedAddress) { using (SqlConnection sqlConnec = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("InsertGeocodedAddress", sqlConnec)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@id", geocodedAddress.Id)); cmd.Parameters.Add(new SqlParameter("@latitude", geocodedAddress.Latitude)); cmd.Parameters.Add(new SqlParameter("@longitude", geocodedAddress.Longitude)); await sqlConnec.OpenAsync(); await cmd.ExecuteNonQueryAsync(); } } }
public void SendGeocodedAddres(GeocodedAddress gaddress) { var factory = new ConnectionFactory() { Uri = new Uri($"amqp://{_username}:{_password}@{_hostname}:{_port}") }; using (var connection = factory.CreateConnection()) using (var channel = connection.CreateModel()) { channel.QueueDeclare(queue: _queueName, durable: false, exclusive: false, autoDelete: false, arguments: null); var json = JsonConvert.SerializeObject(gaddress); var body = Encoding.UTF8.GetBytes(json); channel.BasicPublish(exchange: "", routingKey: _queueName, basicProperties: null, body: body); } }
/// <summary> /// Load the saved information from the previous postback. /// </summary> protected override void LoadViewState(object savedState) { base.LoadViewState(savedState); this.Center = (GeocodedAddress)ViewState["Center"]; this._Loaders = (List <PlacemarkLoader>)ViewState["Loaders"]; this._Placemarks = (List <Placemark>)ViewState["Placemarks"]; this.HideControls = (Boolean)ViewState["HideControls"]; this.HideDownload = (Boolean)ViewState["HideDownload"]; this.HideAddToTag = (Boolean)ViewState["HideAddToTag"]; this.Height = (Int32)ViewState["Height"]; this.Width = (Int32)ViewState["Width"]; this.StaticMap = (Boolean)ViewState["StaticMap"]; this.ShowStreetView = (Boolean)ViewState["ShowStreetView"]; this.ShowPanControls = (Boolean)ViewState["ShowPanControls"]; this.ShowZoomControls = (Boolean)ViewState["ShowZoomControls"]; this.ShowMapType = (Boolean)ViewState["ShowMapType"]; this.MinZoomLevel = (Int32)ViewState["MinZoomLevel"]; this.MaxZoomLevel = (Int32)ViewState["MaxZoomLevel"]; }
/// <summary> /// Create a new GoogleMap instance. Set some defaults and other things. /// </summary> public GoogleMap() : base() { this.Width = 480; this.Height = 360; this._Placemarks = new List <Placemark>(); this._Loaders = new List <PlacemarkLoader>(); this.Center = new GeocodedAddress(); this.Center.Latitude = ArenaContext.Current.Organization.Address.Latitude; this.Center.Longitude = ArenaContext.Current.Organization.Address.Longitude; this.ZoomLevel = 12; this.MinZoomLevel = -1; this.MaxZoomLevel = -1; this.StaticMap = false; this.ShowStreetView = true; this.ShowPanControls = true; this.ShowZoomControls = true; this.ShowMapType = true; this.HideAddToTag = false; this.HideDownload = false; }
private void HandleMessage(GeocodedAddress gAddress) { _addCoordinatesRepository.InsertCoordinates(gAddress); }