public string BuildPredicate(SearchCriteria criteria) { string predicate = string.Empty; if (criteria != null) { var elements = Build(criteria).Where(item => !string.IsNullOrEmpty(item)); predicate = string.Join(" AND ", elements); } return predicate.Trim(); }
public IList<Instrument> SearchInstruments(SearchCriteria criteria) { string query = "SELECT * FROM RMS.RMS_INSTRUMENTS_VIEW"; string predicate = queryBuilder.BuildPredicate(criteria); if (!string.IsNullOrEmpty(predicate)) { query += (" WHERE " + predicate); } return db.Connection().QuerySql<Instrument>(query); }
public static void test_search_query_builder() { var builder = new OracleSearchQueryBuilder(); var criteria = new SearchCriteria() { Connections = new[] { "value1", "value2" } }; string predicate = builder.BuildPredicate(criteria); Assert.Equal("(REGEXP_LIKE(CONNECTION_STATUS, 'value1', 'i') OR REGEXP_LIKE(CONNECTION_STATUS, 'value2', 'i'))", predicate); }
private IEnumerable<string> Build(SearchCriteria criteria) { yield return ProcessArray("CONNECTION_STATUS", criteria.Connections); yield return ProcessValue("EXT_INSTANCE_NO", criteria.InstanceId); yield return ProcessValue("SERIAL_NO", criteria.SerialNumber); yield return ProcessValue("RA_ID", criteria.RA_Id); yield return ProcessArray("INSTRUMENT_MODEL_NAME", criteria.Models); yield return ProcessArray("SUB_MODEL", criteria.SubModels); yield return ProcessValue("SITE_NAME", criteria.InstitutionName); yield return ProcessValue("SITE_CITY", criteria.City); yield return ProcessArray("SITE_STATE", criteria.States); yield return ProcessValue("SITE_COUNTRY", criteria.Country); }
public IList<Instrument> FindInstrument(SearchCriteria criteria) { return repository.FindInstruments(criteria); }
public IList<Instrument> FindInstruments(SearchCriteria criteria) { return db.Connection().QuerySql<Instrument>($"SELECT * FROM RMS.RMS_INSTRUMENTS_VIEW"); }
public IList<Instrument> SearchInstruments(SearchCriteria criteria) { return searchService.SearchInstruments(criteria); }
public IList<Instrument> FindInstrument(SearchCriteria criteria) { return this.searchBusinessService.FindInstrument(criteria); }
public IList<Instrument> SearchInstruments(SearchCriteria criteria) { return searchRepository.SearchInstruments(criteria); }
public IList<Instrument> FindInstruments(SearchCriteria criteria) { return this.instrumentRepository.FindInstruments(criteria); }