SaveReview() public method

public SaveReview ( TblReview r ) : int
r TblReview
return int
Example #1
0
        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);

                }
            }
        }
Example #2
0
        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");
        }
Example #3
0
        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();
            }
        }