public IList <WingResultDto> Find(WingFilter filter) { if (filter == null) { filter = new WingFilter(); } return(_wingImageRepository.Find(filter)); }
public IList <WingResultDto> Find(WingFilter filter) { var param = filter; using (Connection) { var query = new StringBuilder(); query.Append(QueryBase); query.Append(@" (@Text is not null and ( ( ((@Text like '%right%' or @Text like '%direita%' or @Text = 'r') and wi.WingSide = 'r') or ((@Text like '%left%' or @Text like '%left%' or @Text = 'l') and wi.WingSide = 'l') ) or ( ((@Text like '%macho%' or @Text like '%male%' or @Text = 'm') and i.Gender = 'm') or ((@Text like '%femea%' or @Text like '%femêa%' or @Text like '%female%' or @Text = 'f') and wi.WingSide = 'f') ) or (ic.CollectionCode like '%' + @Text + '%') or (ic.LabCode like '%' + @Text + '%') or (ic.TempLabCode like '%' + @Text + '%') or ( l.Country like '%' + @Text + '%' or l.CountryCode like '%' + @Text + '%' ) or ( l.StateOrProvince like '%' + @Text + '%' or l.StateOrProvinceCode like '%' + @Text + '%' ) or ( l.City like '%' + @Text + '%' or l.CityCode like '%' + @Text + '%' ) or (l.Latitude = @Text) or (l.Longitude = @Text) or ( l.StateOrProvince like '%' + @Text + '%' or l.StateOrProvinceCode like '%' + @Text + '%' or l.City like '%' + @Text + '%' or l.CityCode like '%' + @Text + '%' or l.Country like '%' + @Text + '%' or l.CountryCode like '%' + @Text + '%' or l.Neighborhood like '%' + @Text + '%' ) or ( fs.SpecificLocalityInEnglish like '%' + @Text + '%' or fs.SpecificLocalityOriginalLanguage like '%' + @Text + '%' ) or ( f.FamilyName like '%' + @Text + '%' or sf.SubfamilyName like '%' + @Text + '%' ) or ( g.GenericName like '%' + @Text + '%' or sg.SubgenericName like '%' + @Text + '%' ) or ( s.SpecificEpithet like '%' + @Text + '%' or ss.SubspeciesName like '%' + @Text + '%' ) or ( itt.NameInEnglish = '%' + @Text + '%' or itt.NameOriginalLanguage like '%' + @Text + '%' or itt.Abbreviation like '%' + @Text + '%' ) or ( ( convert(varchar, fs.[DateTime], 103) = @Text or convert(varchar, fs.[DateTime], 111) = @Text or (CAST(MONTH(fs.[DateTime]) as varchar) + '/' + CAST(YEAR(fs.[DateTime]) as varchar) = @Text) or (CAST(YEAR(fs.[DateTime]) as varchar) + '/' + CAST(MONTH(fs.[DateTime]) as varchar) = @Text) or (CAST(YEAR(fs.[DateTime]) as varchar) = @Text) ) or ( convert(varchar, o.DonationDatetime, 103) = @Text or convert(varchar, o.DonationDatetime, 111) = @Text or (CAST(MONTH(o.DonationDatetime) as varchar) + '/' + CAST(YEAR(o.DonationDatetime) as varchar) = @Text) or (CAST(YEAR(o.DonationDatetime) as varchar) + '/' + CAST(MONTH(o.DonationDatetime) as varchar) = @Text) or (CAST(YEAR(o.DonationDatetime) as varchar) = @Text) ) ) ) ) or( @Text is null and( (@WingSide is null or wi.WingSide = @WingSide) and (@Gender is null or i.Gender = @Gender) and (@Lecz is null or ic.CollectionCode like '%' + @Lecz + '%') and (@MosquitoLabCode is null or ic.LabCode like '%' + @MosquitoLabCode + '%') and (@Date is null or ( ( CAST(fs.[DateTime] as smalldatetime) = CAST( @Date as smalldatetime) or (MONTH(fs.[DateTime]) = MONTH(@Date) and YEAR(fs.[DateTime]) = YEAR(@Date)) or (YEAR(fs.[DateTime]) = YEAR(@Date)) ) or ( CAST(o.DonationDatetime as smalldatetime) = CAST( @Date as smalldatetime) or (MONTH(o.DonationDatetime) = MONTH(@Date) and YEAR(o.DonationDatetime) = YEAR(@Date)) or (YEAR(o.DonationDatetime) = YEAR(@Date)) ) ) ) and (@Country is null or ( l.Country like '%' + @Country + '%' or l.CountryCode like '%' + @Country + '%' ) ) and (@State is null or ( l.StateOrProvince like '%' + @State + '%' or l.StateOrProvinceCode like '%' + @State + '%' ) ) and (@City is null or ( l.City like '%' + @City + '%' or l.CityCode like '%' + @City + '%' ) ) and (@Latitude is null or l.Latitude = @Latitude) and (@Latitude is null or l.Longitude = @Longitude) and (@Locality is null or ( l.StateOrProvince like '%' + @Locality + '%' or l.StateOrProvinceCode like '%' + @Locality + '%' or l.City like '%' + @Locality + '%' or l.CityCode like '%' + @Locality + '%' or l.Country like '%' + @Locality + '%' or l.CountryCode like '%' + @Locality + '%' or l.Neighborhood like '%' + @Locality + '%' ) ) and (@SpecificLocality is null or ( fs.SpecificLocalityInEnglish like '%' + @SpecificLocality + '%' or fs.SpecificLocalityOriginalLanguage like '%' + @SpecificLocality + '%' ) ) and (@Family is null or ( f.Id = @Family ) ) and (@Subfamily is null or ( sf.Id = @Subfamily ) ) and (@Tribe is null or ( t.Id = @Tribe ) ) and (@Genus is null or ( g.Id = @Genus ) ) and (@Specie is null or ( s.Id = @Specie or ss.SpeciesId = @Specie ) ) and (@InstitutionName is null or ( itt.NameInEnglish = '%' + @InstitutionName+ '%' or itt.NameOriginalLanguage like '%' + @InstitutionName + '%' or itt.Abbreviation like '%' + @InstitutionName + '%' ) ) ) ) ORDER BY wi.AccessionCode ASC "); return(Connection.Query <WingResultDto>(query.ToString(), param).ToList()); } }
public JsonResultHelper Find(WingFilter filter = null) { var wings = _wingImageRepository.Find(filter); return(new JsonResultHelper(wings, JsonRequestBehavior.AllowGet)); }
// GET: Result public ActionResult Index(WingFilter filter = null) { var wings = _wingImageRepository.Find(filter); return(View(wings)); }