public GeolocationDBStoredProcedures.PGetUnverifiedAddressResult GetUnverifiedAddress() { using (var db = new DataModels.GeolocationDB()) { LinqToDB.Data.DataConnection connect = new LinqToDB.Data.DataConnection(); connect.CommandTimeout = 100000; GeolocationDBStoredProcedures.PGetUnverifiedAddressResult re = DataModels.GeolocationDBStoredProcedures.PGetUnverifiedAddress(connect).FirstOrDefault(); return(re); } }
/// <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; }