public ActionResult Delete(FormCollection collection) { ITaxonRepository Taxon = new TaxonRepository(); var reviewID = Int32.Parse(collection["ID"]); TblReview r = Taxon.getReview(reviewID); Taxon.deleteReview(r); return(RedirectToAction("Delete")); }
public ActionResult Create(FormCollection collection) { try { ITaxonRepository taxon = new TaxonRepository(); IGenericRepository generics = new GenericRepository(); IReviewRepository reviews = new ReviewRepository(); // TODO: Add insert logic here TblReview r = new TblReview(); int kingdom = 0; int reviewtype = 0; kingdom = collection["addkingdom"].Equals("animal") ? generics.getExternalRef(UpdateUtils.ANIMALS, UpdateUtils.TYPE_KINGDOM) : generics.getExternalRef(UpdateUtils.PLANTS, UpdateUtils.TYPE_KINGDOM); //reviewtype = collection["reviewtype"].Equals("normal") ? // generics.getExternalRef(UpdateUtils.REVIEW_NORMAL, UpdateUtils.TYPE_REVIEW) : // generics.getExternalRef(UpdateUtils.REVIEW_ADHOC, UpdateUtils.TYPE_REVIEW); r.CountryID = int.Parse(collection["countries"]); r.AddedBy = 2; r.AddedByName= Membership.GetUser().ToString(); r.DateAdded = DateTime.Now; r.PhaseID = int.Parse(collection["addphase"]); int speciesId = int.Parse(collection["species"]); r.TaxonID = speciesId; r.TaxonLevel = generics.getExternalRef(UpdateUtils.SPECIES, UpdateUtils.TYPE_TAXONLEVEL); r.KingdomID = kingdom; // r.CommitteeID = int.Parse(collection["committee"]); r.CommitteeID = 1; r.ReviewDate = DateTime.Now; r.ReviewType = 1; int ID= taxon.SaveReview(r); ReviewStatus rs = new ReviewStatus(); rs.Status = generics.getExternalRef(UpdateUtils.SELECTION, UpdateUtils.REVIEWSTATUS); rs.DateAdded = DateTime.Now; rs.ReviewID = ID; reviews.saveReviewStatus(rs); // return RedirectToAction("List","AddReview"); return RedirectToAction("Details", "ProcessReview", new {id = ID}); } catch { //Do nothing - caught below } return RedirectToAction("AddReview", "AddReview"); }
public ActionResult Create(FormCollection collection) { try { ITaxonRepository taxon = new TaxonRepository(); IGenericRepository generics = new GenericRepository(); IReviewRepository reviews = new ReviewRepository(); // TODO: Add insert logic here TblReview r = new TblReview(); int kingdom = 0; int reviewtype = 0; kingdom = collection["addkingdom"].Equals("animal") ? generics.getExternalRef(UpdateUtils.ANIMALS, UpdateUtils.TYPE_KINGDOM) : generics.getExternalRef(UpdateUtils.PLANTS, UpdateUtils.TYPE_KINGDOM); //reviewtype = collection["reviewtype"].Equals("normal") ? // generics.getExternalRef(UpdateUtils.REVIEW_NORMAL, UpdateUtils.TYPE_REVIEW) : // generics.getExternalRef(UpdateUtils.REVIEW_ADHOC, UpdateUtils.TYPE_REVIEW); r.CountryID = int.Parse(collection["countries"]); r.AddedBy = 2; r.AddedByName = Membership.GetUser().ToString(); r.DateAdded = DateTime.Now; r.PhaseID = int.Parse(collection["addphase"]); int speciesId = int.Parse(collection["species"]); r.TaxonID = speciesId; r.TaxonLevel = generics.getExternalRef(UpdateUtils.SPECIES, UpdateUtils.TYPE_TAXONLEVEL); r.KingdomID = kingdom; // r.CommitteeID = int.Parse(collection["committee"]); r.CommitteeID = 1; r.ReviewDate = DateTime.Now; r.ReviewType = 1; int ID = taxon.SaveReview(r); ReviewStatus rs = new ReviewStatus(); rs.Status = generics.getExternalRef(UpdateUtils.SELECTION, UpdateUtils.REVIEWSTATUS); rs.DateAdded = DateTime.Now; rs.ReviewID = ID; reviews.saveReviewStatus(rs); // return RedirectToAction("List","AddReview"); return(RedirectToAction("Details", "ProcessReview", new { id = ID })); } catch { //Do nothing - caught below } return(RedirectToAction("AddReview", "AddReview")); }
public ActionResult EditReview(int id, FormCollection collection) { try { // TODO: Add update logic here IReviewRepository reviews = new ReviewRepository(); ITaxonRepository taxons = new TaxonRepository(); TblReview review = reviews.getSingleReviewEdit(id); IGenericRepository generics = new GenericRepository(); int kingdom = 0; int reviewtype = 0; kingdom = collection["kingdom"].Equals("animal") ? generics.getExternalRef(UpdateUtils.ANIMALS, UpdateUtils.TYPE_KINGDOM) : generics.getExternalRef(UpdateUtils.PLANTS, UpdateUtils.TYPE_KINGDOM); //reviewtype = collection["reviewtype"].Equals("normal") ? // generics.getExternalRef(UpdateUtils.REVIEW_NORMAL, UpdateUtils.TYPE_REVIEW) : // generics.getExternalRef(UpdateUtils.REVIEW_ADHOC, UpdateUtils.TYPE_REVIEW); review.CountryID = int.Parse(collection["countries"]); review.AddedBy = 2; review.DateAdded = DateTime.Now; review.PhaseID = int.Parse(collection["addphase"]); review.TaxonID = int.Parse(collection["species"]);; review.TaxonLevel = generics.getExternalRef(UpdateUtils.SPECIES, UpdateUtils.TYPE_TAXONLEVEL); review.KingdomID = kingdom; //review.CommitteeID = int.Parse(collection["committee"]); review.CommitteeID = 1; //r.ReviewDate = DateTime.Now; //r.ReviewType = reviewtype; int ID = taxons.SaveReview(review); //ReviewStatus rs = new ReviewStatus(); //rs.Status = generics.getExternalRef(UpdateUtils.SELECTION, UpdateUtils.REVIEWSTATUS); //rs.DateAdded = DateTime.Now; //rs.ReviewID = ID; //reviews.saveReviewStatus(rs); return(RedirectToAction("List")); } catch { return(View()); } }
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()); }
private void saveSpeciesForReview() { ITaxonRepository Taxon = new TaxonRepository(); IGenericRepository gen = new GenericRepository(); IReviewRepository rr = new ReviewRepository(); if (TempData["CurrentData"] != null) { DataTable dt = (DataTable)TempData["CurrentData"]; int rowcount = dt.Rows.Count; ITaxonRepository taxon = new TaxonRepository(); for (int i = 0; i < rowcount; i++) { DataRow dr = dt.Rows[i]; TblReview r = new TblReview(); r.PhaseID = int.Parse(dr[1].ToString()); r.KingdomID = taxon.getTaxonLevelID(dr[7].ToString()); r.TaxonLevel = taxon.getTaxonLevelID(dr[2].ToString()); r.TaxonID = int.Parse(dr[4].ToString()); r.DateAdded = DateTime.Now; r.CountryID = int.Parse(dr[6].ToString()); int ID = taxon.SaveReview(r); ReviewStatus rs = new ReviewStatus(); rs.Status = gen.getExternalRef(UpdateUtils.SELECTION, UpdateUtils.REVIEWSTATUS); rs.DateAdded = DateTime.Now; rs.ReviewID = ID; rr.saveReviewStatus(rs); } } }