예제 #1
0
        //
        // GET: /AddReview/AddCountries

        public ActionResult GetCountries(bool ajax, string speciesID, string kingdom)
        {
            IGenericRepository gen = new GenericRepository();

            ITaxonRepository taxon = new TaxonRepository();

            IList <AGeneralTaxon> lists = null;
            int _speciesID = int.Parse((speciesID));

            if (kingdom.Equals("animal"))
            {
                lists = taxon.getCountries(_speciesID, UpdateUtils.SPECIES, UpdateUtils.ANIMALS);
            }
            else if (kingdom.Equals("plant"))
            {
                lists = taxon.getCountries(_speciesID, UpdateUtils.SPECIES, UpdateUtils.PLANTS);
            }

            // return Json(taxons.getCountries(3, UpdateUtils.PHYLUM, UpdateUtils.ANIMALS).ToList());
            return(Json(lists));
        }
예제 #2
0
        public ActionResult EditReview(int id)
        {
            IReviewRepository  reviews  = new ReviewRepository();
            IGenericRepository generics = new GenericRepository();
            ITaxonRepository   taxons   = new TaxonRepository();

            TblReview review = reviews.getSingleReviewEdit(id);

            ViewData["addphase"]  = new SelectList(generics.getAllPhase(), "ID", "PhaseDesc", review.PhaseID);
            ViewData["committee"] = new SelectList(generics.getAllCommittees(), "ID", "Description", review.CommitteeID);

            int animal = generics.getExternalRef(UpdateUtils.ANIMALS, UpdateUtils.TYPE_KINGDOM);
            int kingdom = (int)review.KingdomID;
            IList <AGeneralTaxon> lists_countries, lists_genus, lists_species = null;
            int    SpeciesID = review.TaxonID.GetValueOrDefault();
            Taxons genus     = taxons.getTaxonbySpecies(SpeciesID, (int)review.KingdomID);

            if (review.KingdomID == animal)
            {
                lists_countries = taxons.getCountries(SpeciesID, UpdateUtils.SPECIES, UpdateUtils.ANIMALS);
                lists_genus     = taxons.getAGenus();
                lists_species   = taxons.getASpeciesbyGenus(genus.genrecid);
            }
            else
            {
                lists_countries = taxons.getCountries(SpeciesID, UpdateUtils.SPECIES, UpdateUtils.PLANTS);
                lists_genus     = taxons.getPGenus();
                lists_species   = taxons.getPSpeciesbyGenus(genus.genrecid);
            }

            ViewData["animal"]    = animal;
            ViewData["kingdom"]   = kingdom;
            ViewData["countries"] = new SelectList(lists_countries, "RecID", "TaxonName", review.CountryID);
            ViewData["genus"]     = new SelectList(lists_genus, "RecID", "TaxonName", genus.genrecid);
            ViewData["species"]   = new SelectList(lists_species, "RecID", "TaxonName", SpeciesID);

            return(View());
        }