//public IEnumerable<CardPoint> GetPointsCustomerUsedViber(int id) //{ // using (DictEpicetnrK dict = new DictEpicetnrK()) // { // return dict.GetPointsCustomerUsedViber(); // } //} public int GetCountPointsByMarketRadius(int id) { var parameters = Request.GetQueryNameValuePairs(); var radius = parameters.Where(o => o.Key == "radius").FirstOrDefault(); using (DictEpicetnrK dict = new DictEpicetnrK()) { return(dict.GetCountPointsByMarketRadius(id, Convert.ToInt32(radius.Value))); } }
public IEnumerable <CardPoint> GetPointsByMarketRadius(int id) { var parameters = Request.GetQueryNameValuePairs(); var radius = parameters.Where(o => o.Key == "radius").FirstOrDefault(); using (DictEpicetnrK dict = new DictEpicetnrK()) { return(dict.GetPointsByMarketRadius(id, Convert.ToInt32(radius.Value)) .Select(x => new CardPoint { formatted_address = x.formatted_address, lat = x.lat.Value, lng = x.lng.Value, point_id = x.point_id.Value, search_engine_status = x.search_engine_status })); } }
public IEnumerable <CardPoint> GetPointsByMarketId(int id) { var parameters = Request.GetQueryNameValuePairs(); var visit = parameters.Where(o => o.Key == "visit").FirstOrDefault(); var distance = parameters.Where(o => o.Key == "distance").FirstOrDefault(); DictEpicetnrK dict = new DictEpicetnrK(); return(dict.GetPointsByMarketId(id).Select(x => new CardPoint { formatted_address = x.FormattedAddress, lat = x.Lat.Value, lng = x.Lng.Value, point_id = x.PointId.Value, search_engine_status = x.SearchEngineStatus })); }
// GET api/market/5 public DataModels.DictTradeMarkets Get(int id) { using (DictEpicetnrK dict = new DictEpicetnrK()) return(dict.GetMarketById(id)); }
// GET api/market public IEnumerable <DataModels.DictTradeMarkets> Get() { using (DictEpicetnrK dict = new DictEpicetnrK()) return(dict.GetMarkets()); }
public void SetEpicentrKPoint(ProcessPoint p) { using (DictEpicetnrK edict = new DictEpicetnrK()) { if (p.Coordinate != null) { edict.SetEpicentrKPoint( p.PointId, p.CardId, p.CrmCustomerId, p.GetSearchEngineStatus(), p.FormattedAddress, p.Xml, p.Coordinate.Lat, p.Coordinate.Lng ); if (p.SearchEngine == SearchEngine.Osm) { Core.ObjectSerializer.Place place = (Core.ObjectSerializer.Place)p.Conteiner; edict.SetOsmPoint( place.Osm_id, p.PointId, place.House_number, place.Road, place.Village, place.Town, place.City, place.County, place.Postcode, place.Country, place.Country_code, place.Place_id, place.Osm_type, place.Boundingbox, place.Polygonpoints, place.Lat, place.Lon, place.Display_name, place.Class, place.Type ); } } else { edict.SetEpicentrKPoint( p.PointId, p.CardId, p.CrmCustomerId, p.GetSearchEngineStatus(), p.FormattedAddress, p.Xml ); } } //string DbConnectString = ConfigurationManager.AppSettings["DbConnectString"]; //using (SqlConnection connect = new SqlConnection(DbConnectString)) //{ // SqlCommand cmd = connect.CreateCommand(); // cmd.CommandText = "dbo.set_point_address"; // cmd.CommandType = CommandType.StoredProcedure; // string Latitude = Point.Coordinate == null ? string.Empty : Point.Coordinate.Lat; // string Longitude = Point.Coordinate == null ? string.Empty : Point.Coordinate.Lng; // cmd.Parameters.AddWithValue("@card_id", Point.CardId); // cmd.Parameters.AddWithValue("@lat", Latitude); // cmd.Parameters.AddWithValue("@lng", Longitude); // cmd.Parameters.AddWithValue("@google_status", Point.Status.ToString()); // cmd.Parameters.AddWithValue("@formatted_address", Point.FormattedAddress); // cmd.Parameters.AddWithValue("@xml", Point.Xml); // try // { // cmd.Connection.Open(); // cmd.ExecuteNonQuery(); // cmd.Connection.Close(); // } // catch (Exception ex) // { // SetError("Ошибка сохранения точки в БД", ex); // } // finally // { // if (connect.State != ConnectionState.Closed) connect.Close(); // } //} }
/// <summary> /// /// </summary> /// <returns></returns> public ProcessPoint GetEpicentrKPointForGeocoding() { //TODO пишемо запит в БД через храниму процедуру gpo.get_unchecked_address //PointMap Point = new PointMap(); using (DictEpicetnrK edict = new DictEpicetnrK()) { GeolocationDBStoredProcedures.PGetUnverifiedAddressResult re = edict.GetUnverifiedAddress(); if (re != null) { return(new ProcessPoint { PointId = re.pointId.Value, CardId = re.card_id.Value, CrmCustomerId = re.crm_customer_id.Value, SourceAddress = re.adress, Type = PointType.CustomerEpicentrK, addressDb = new AddressDb { City = re.city, District = re.district, HouseNumber = re.house_number, Region = re.region, Street = re.street } }); } else { return(null); } } //Point.Type = PointType.CustomerEpicentrK; //string DbConnectString = ConfigurationManager.AppSettings["DbConnectString"]; //using (SqlConnection connect = new SqlConnection(DbConnectString)) //{ // SqlCommand cmd = connect.CreateCommand(); // cmd.CommandText = "dbo.get_unchecked_address"; // cmd.CommandType = CommandType.StoredProcedure; // try // { // cmd.Connection.Open(); // SqlDataReader reader = cmd.ExecuteReader(); // DataTable t = new DataTable(); // t.Load(reader); // cmd.Connection.Close(); // if (t.Rows.Count > 0) { // Point.CardId = Convert.ToInt64(t.Rows[0]["card_id"]); // Point.SourceAddress = Convert.ToString(t.Rows[0]["source_address"]);} // } // catch (Exception ex) // { // SetError("Ошибка получения адреса", ex); // } // finally // { // if (connect.State != ConnectionState.Closed) connect.Close(); // } //} //return Point; }