getSingleReviewEdit() public méthode

public getSingleReviewEdit ( int ID ) : TblReview
ID int
Résultat TblReview
Exemple #1
0
        public static int InsertParagraphActionForm(FormCollection collection)
        {
            IReviewRepository reviews = new ReviewRepository();
            IGenericRepository generics = new GenericRepository();

            ParagraphAction pa = new ParagraphAction();

            int palibid = int.Parse(collection["PALibID"]);
            int reviewid = int.Parse(collection["ReviewID"]);
            pa.PALibID = palibid;
            pa.DateStarted = DateTime.Parse(collection["pda_started_date"].ToString());
            pa.DeadlineDate = DateTime.Parse(collection["pda_deadline_date"].ToString());
            pa.MeetingID = int.Parse(collection["meetings"]);
            pa.ReviewID = reviewid;         
            //string concern = collection["concerns"].ToString();)

            if (collection["concerns"] != null)
            {
                string concern = collection["concerns"].ToString();
                switch(concern)
                {
                    case UpdateUtils.URGENT_CONCERN:
                        pa.ConcernID = UpdateUtils.URGENT_CONCERN_ID;
                        
                        break;
                    case UpdateUtils.POSSIBLE_CONCERN:
                        pa.ConcernID = UpdateUtils.POSSIBLE_CONCERN_ID;
                        break;
                    case UpdateUtils.LEAST_CONCERN:
                        pa.ConcernID = UpdateUtils.LEAST_CONCERN_ID;
                        break;
                    case UpdateUtils.NOT_CLASSIFIED:
                        pa.ConcernID = UpdateUtils.NOT_CLASSIFIED_ID;
                        break;
                }
                TblReview review = reviews.getSingleReviewEdit(reviewid);
                review.ConcernID = pa.ConcernID;
                DB.Save(review);
                generics.resetCurrentConcernForReview(reviewid);
                pa.CurrentConcern = true;
            }
            else
            {
                pa.ConcernID = UpdateUtils.NOT_CLASSIFIED_ID;
                pa.CurrentConcern = true;
            }
            
            string completed = collection["completed"];
           
            if ((completed!=null) && (completed.Equals("on")))
            {
                DateTime dateCompleted = DateTime.Now;
                if (collection["pda_completed_date"] != null && collection["pda_completed_date"].Length > 0) {
                    dateCompleted = DateTime.Parse(collection["pda_completed_date"]);
                    pa.CompletedDate = dateCompleted;
                }
                else {
                    pa.CompletedDate = dateCompleted;
                }             
                pa.Completed = true;
            }

            pa.DateAdded = DateTime.Now;
            return reviews.SavePA(pa);
        }
Exemple #2
0
        public static int InsertParagraphActionForm(FormCollection collection)
        {
            IReviewRepository reviews = new ReviewRepository();
            IGenericRepository generics = new GenericRepository();

            ParagraphAction pa = new ParagraphAction();

            int palibid = int.Parse(collection["PALibID"]);
            int reviewid = int.Parse(collection["ReviewID"]);
            pa.PALibID = palibid;
            pa.DateStarted = DateTime.Parse(collection["pda_started_date"].ToString());
            pa.DeadlineDate = DateTime.Parse(collection["pda_deadline_date"].ToString());
            pa.MeetingID = int.Parse(collection["meetings"]);
            pa.ReviewID = reviewid;
            //string concern = collection["concerns"].ToString();)

            if (collection["concerns"] != null)
            {
                string concern = collection["concerns"].ToString();
                switch(concern)
                {
                    case UpdateUtils.URGENT_CONCERN:
                        pa.ConcernID = UpdateUtils.URGENT_CONCERN_ID;

                        break;
                    case UpdateUtils.POSSIBLE_CONCERN:
                        pa.ConcernID = UpdateUtils.POSSIBLE_CONCERN_ID;
                        break;
                    case UpdateUtils.LEAST_CONCERN:
                        pa.ConcernID = UpdateUtils.LEAST_CONCERN_ID;
                        break;
                    case UpdateUtils.NOT_CLASSIFIED:
                        pa.ConcernID = UpdateUtils.NOT_CLASSIFIED_ID;
                        break;
                }
                TblReview review = reviews.getSingleReviewEdit(reviewid);
                review.ConcernID = pa.ConcernID;
                DB.Save(review);
                generics.resetCurrentConcernForReview(reviewid);
                pa.CurrentConcern = true;
            }
            else
            {
                pa.ConcernID = UpdateUtils.NOT_CLASSIFIED_ID;
                pa.CurrentConcern = true;
            }

            string completed = collection["completed"];

            if ((completed!=null) && (completed.Equals("on")))
            {
                DateTime dateCompleted = DateTime.Now;
                if (collection["pda_completed_date"] != null && collection["pda_completed_date"].Length > 0) {
                    dateCompleted = DateTime.Parse(collection["pda_completed_date"]);
                    pa.CompletedDate = dateCompleted;
                }
                else {
                    pa.CompletedDate = dateCompleted;
                }
                pa.Completed = true;
            }

            pa.DateAdded = DateTime.Now;
            return reviews.SavePA(pa);
        }
        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 SaveCompleted(FormCollection collection)
        {
            try
            {
                IGenericRepository generics = new GenericRepository();
                IReviewRepository reviews = new ReviewRepository();
                int PActionID = int.Parse(collection["SourceID"].ToString());

                string completed = collection["ckCompleted"];

                DateTime dateCompleted = DateTime.Now;

                ParagraphAction PAction = reviews.getParagraphActionbyID(PActionID);
                int ReviewID = int.Parse(PAction.ReviewID.ToString());

                if (collection["selectedactorsedit"] != null)
                {
                    collection["users"] = collection["selectedactorsedit"];
                    UpdateUtils.InsertUsersPerParagraph(collection, PActionID, UpdateUtils.PARAGRAPH_SOURCE);
                }
               // string selected = collection["selectedactorsedit"].ToString();
              //  string[] listselected = selected.Split(',');

              //  int count = listselected.Length;
              //  for (int j = 0; j < count; j++)
              //  {
              //      string key = Membership.GetUser(listselected[j]).ProviderUserKey.ToString();
              //  }

                if (completed != null)
                {
                    PAction.Completed = true;
                    if (collection["edit_date_completed"] != null && collection["edit_date_completed"].Length > 0)
                    {
                        dateCompleted = DateTime.Parse(collection["edit_date_completed"]);
                    }
                   PAction.CompletedDate = dateCompleted;
                }
                else
                {
                    PAction.Completed = false;
                    PAction.DateModified = DateTime.Now;
                }
                //Save the rest of the data
                var deadlineDate = collection["Deadline"] == null ? ((DateTime)PAction.DateStarted).AddDays(30) : DateTime.Parse(collection["Deadline"].ToString());
                var startedDate = DateTime.Parse(collection["DateStarted"]);
                PAction.DeadlineDate = deadlineDate;
                PAction.DateStarted = startedDate;
                if (collection["concerns"] != null)
                {
                    string concern = collection["concerns"];
                    switch (concern) {
                        case UpdateUtils.URGENT_CONCERN:
                            PAction.ConcernID = UpdateUtils.URGENT_CONCERN_ID;

                            break;
                        case UpdateUtils.POSSIBLE_CONCERN:
                            PAction.ConcernID = UpdateUtils.POSSIBLE_CONCERN_ID;
                            break;
                        case UpdateUtils.LEAST_CONCERN:
                            PAction.ConcernID = UpdateUtils.LEAST_CONCERN_ID;
                            break;
                        case UpdateUtils.NOT_CLASSIFIED:
                            PAction.ConcernID = UpdateUtils.NOT_CLASSIFIED_ID;
                            break;
                    }

                    ParagraphAction topPA = generics.getParagraphActionPerReview(PAction.ReviewID.Value);
                    if (topPA.Id == PAction.Id)
                    {
                        TblReview review = reviews.getSingleReviewEdit(PAction.ReviewID);
                        review.ConcernID = PAction.ConcernID;
                        DB.Save(review);
                        generics.resetCurrentConcernForReview(PAction.ReviewID.Value);
                        PAction.CurrentConcern = true;
                    }

                }
                PAction.MeetingID = Int32.Parse(collection["Meetings"]);
                PAction.DateModified = DateTime.Now;

                int i= reviews.SavePA(PAction);

                return RedirectToAction("Details","ProcessReview", new {ID=ReviewID});
            }
            catch
            {
                //return View();
                return null;

            }
        }
        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();
        }