public List <Publication> Search(PublicationQuery query) { var result = new List <Publication>(); var lang = query.LanguageId.ToString(); using (var command = Context.Connection.GenerateCommand( "ais.search_news", new { id = query.Id, title = query.Name, newtypeid = query.TypeId, regdatefrom = query.EnterDateFrom, regdateto = query.EnterDateTo, languageid = query.LanguageId, startdatefrom = query.StartDateFrom, startdateto = query.StartDateTo, isvisible = query.IsVisible })) { using (var reader = command.ExecuteReaderSafety()) { while (reader.Read()) { result.Add( new Publication { Id = reader.GetFieldValue <Guid?>("id"), EnterDate = reader.GetFieldValue <DateTime?>("regdate"), StartDate = reader.GetFieldValue <DateTime?>("startdate"), EndDate = reader.GetFieldValue <DateTime?>("enddate"), IsVisibleInWeb = reader.GetFieldValue <bool>("isvisible"), Type = new Nomenclature { Id = reader.GetFieldValue <Guid?>("newtypeid"), Name = reader.GetFieldValue <string>("newtypename") }, IsLead = reader.GetFieldValue <bool>("islead"), Titles = new SortedDictionary <string, string> { { lang, reader.GetFieldValue <string>("title") } }, Contents = new SortedDictionary <string, string> { { lang, reader.GetFieldValue <string>("content") } } }); } } } return(result); }
public List <Publication> Search(PublicationQuery query) { query.LanguageId = RequestData.LanguageId; return(publicationRepository.Search(query)); }