public OfferList GetAllOffers() { OfferList offersByPreferences = new OfferList(); using (SqlConnection sqlConnection = new SqlConnection(this.GetDatabaseConnection)) { using (SqlCommand sqlCommand = new SqlCommand()) { sqlCommand.CommandText = "spGetAllOffers";// Add SP name sqlCommand.CommandType = System.Data.CommandType.StoredProcedure; sqlCommand.Connection = sqlConnection; sqlConnection.Open(); using (System.Data.Common.DbDataReader reader = sqlCommand.ExecuteReader()) { if (reader != null && reader.HasRows) { offersByPreferences.Offers = GetOfferDetailObject(reader); } } if (sqlConnection.State == System.Data.ConnectionState.Open) sqlConnection.Close(); } } return offersByPreferences; }
public OfferList GetOffersByPreferences(string preferences) { OfferList offersByPreferences = new OfferList(); using (SqlConnection sqlConnection = new SqlConnection(this.GetDatabaseConnection)) { using (SqlCommand sqlCommand = new SqlCommand()) { sqlCommand.CommandText = "spGetOfferByCategory";// Add SP name sqlCommand.CommandType = System.Data.CommandType.StoredProcedure; #region Settings StoredProcedure Parameters SqlParameter parameterPreferences = GetSqlParameter(preferences, "@Category", System.Data.DbType.String, System.Data.ParameterDirection.Input, 200); sqlCommand.Parameters.Add(parameterPreferences); #endregion sqlCommand.Connection = sqlConnection; sqlConnection.Open(); using (System.Data.Common.DbDataReader reader = sqlCommand.ExecuteReader()) { offersByPreferences.Offers = GetOfferDetailObject(reader); } if (sqlConnection.State == System.Data.ConnectionState.Open) sqlConnection.Close(); } } return offersByPreferences; }
public OfferList GetOffersByPreferences(string preferences) { OfferList offers = new OfferList(); try { HooServices.Manager.DataConnectManager dbManager = new Manager.DataConnectManager(); offers = dbManager.GetOffersByPreferences(preferences); } catch (Exception ex) { DataConnectManager.AddError("Method Name:GetOffersByPreferences Details: " + ex.ToString()); } return offers; }
public OfferList GetOffersByLatLong(double latitude, double longitude) { OfferList offersByPreferences = new OfferList(); using (SqlConnection sqlConnection = new SqlConnection(this.GetDatabaseConnection)) { using (SqlCommand sqlCommand = new SqlCommand()) { sqlCommand.CommandText = "spGetOfferByLocation";// Add SP name sqlCommand.CommandType = System.Data.CommandType.StoredProcedure; #region Settings StoredProcedure Parameters SqlParameter parameterLat = GetSqlParameter(latitude, "@Latitude", System.Data.DbType.Double, System.Data.ParameterDirection.Input); SqlParameter parameterLong = GetSqlParameter(longitude, "@Longitude", System.Data.DbType.Double, System.Data.ParameterDirection.Input); sqlCommand.Parameters.Add(parameterLat); sqlCommand.Parameters.Add(parameterLong); #endregion sqlCommand.Connection = sqlConnection; sqlConnection.Open(); using (System.Data.Common.DbDataReader reader = sqlCommand.ExecuteReader()) { if (reader != null && reader.HasRows) { offersByPreferences.Offers = GetOfferDetailObject(reader); } } if (sqlConnection.State == System.Data.ConnectionState.Open) sqlConnection.Close(); } } return offersByPreferences; }
public OfferList GetOffersByLatLong(double latitude, double longitude) { OfferList offers = new OfferList(); try { DataConnectManager dbManager = new Manager.DataConnectManager(); offers = dbManager.GetOffersByLatLong(latitude, longitude); } catch (Exception ex) { DataConnectManager.AddError("Method Name:GetOffersByLatLong Details: " + ex.ToString()); } return offers; }