Пример #1
0
        //Get the Variant id's (Lily)
        private List <long?> GetVariantIds(string variant)
        {
            //possibility to set variable to N/A because some plants have no variants
            if (variant == NoVariant)
            {
                return(new List <long?> {
                    null
                });
            }

            var variants = _context.TfgsvVariant.ToList().Where(v =>
                                                                PlantenParser.ParseSearchText(v.Variantnaam)
                                                                .Contains(PlantenParser.ParseSearchText(variant)))
                           .Select(v => v.VariantId)
                           .Cast <long?>()
                           .ToList();

            //add null to the list to find plants without variants
            if (variant == string.Empty)
            {
                variants.Add(null);
            }

            return(variants);
        }
Пример #2
0
 //Search the plants based on Id and Name(Lily)
 private List <Plant> SearchPlantsWithTgsvAndName(List <long> typeIds, List <long> familyIds,
                                                  List <long> genusIds, List <long> speciesIds, List <long?> variantIds, string name)
 {
     return(_context.Plant
            .Include(p => p.Abiotiek)
            .Include(p => p.AbiotiekMulti)
            .Include(p => p.BeheerMaand)
            .Include(p => p.Commensalisme)
            .Include(p => p.CommensalismeMulti)
            .Include(p => p.ExtraEigenschap)
            .Include(p => p.Fenotype)
            .Include(p => p.Foto)
            .ToList()
            .Where(p =>
                   variantIds.Contains(p.VariantId) &&
                   speciesIds.Contains((long)p.SoortId !) &&
                   genusIds.Contains((long)p.GeslachtId !) &&
                   familyIds.Contains((long)p.FamilieId !) &&
                   typeIds.Contains((long)p.TypeId !) &&
                   PlantenParser.ParseSearchText(p.Fgsv)
                   .Contains(PlantenParser.ParseSearchText(name)))
            .Select(p =>
     {
         p.Variant ??= NoVariant;
         return p;
     })
            .OrderBy(p => p.Fgsv)
            .ToList());
 }
Пример #3
0
 //Get the Species id's (Lily)
 private List <long> GetSpeciesIds(string species)
 {
     return(_context.TfgsvSoort.ToList().Where(s =>
                                               PlantenParser.ParseSearchText(s.Soortnaam)
                                               .Contains(PlantenParser.ParseSearchText(species)))
            .Select(s => s.Soortid)
            .ToList());
 }
Пример #4
0
 //Get the Genus id's (Lily)
 private List <long> GetGenusIds(string genus)
 {
     return(_context.TfgsvGeslacht.ToList().Where(g =>
                                                  PlantenParser.ParseSearchText(g.Geslachtnaam)
                                                  .Contains(PlantenParser.ParseSearchText(genus)))
            .Select(g => g.GeslachtId)
            .ToList());
 }
Пример #5
0
 //Get the family id's (Lily)
 private List <long> GetFamilyIds(string family)
 {
     return(_context.TfgsvFamilie.ToList().Where(f =>
                                                 PlantenParser.ParseSearchText(f.Familienaam)
                                                 .Contains(PlantenParser.ParseSearchText(family)))
            .Select(f => f.FamileId)
            .ToList());
 }
Пример #6
0
 //Get the Type Id's (Lily)
 private List <long> GetTypeIds(string type)
 {
     return(_context.TfgsvType.ToList().Where(t =>
                                              PlantenParser.ParseSearchText(t.Planttypenaam)
                                              .Contains(PlantenParser.ParseSearchText(type)))
            .Select(t => t.Planttypeid)
            .ToList());
 }
Пример #7
0
 //get all unique species names (Davy&Lily&Jim)
 public List <string> GetUniqueSpeciesNames()
 {
     return(_context.TfgsvSoort
            .ToList()
            .Select(s => PlantenParser.ParseSearchText(s.Soortnaam))
            .Distinct()
            .OrderBy(soortnaam => soortnaam)
            .ToList());
 }
Пример #8
0
        //get all unique variants (Davy&Lily&Jim)
        public List <string> GetUniqueVariantNames()
        {
            var list = _context.TfgsvVariant
                       .ToList()
                       .Select(v => v.Variantnaam)
                       .Distinct()
                       .OrderBy(variantnaam => PlantenParser.ParseSearchText(variantnaam))
                       .ToList();

            list.Insert(0, NoVariant);

            return(list);
        }