resetCurrentConcernForReview() public method

public resetCurrentConcernForReview ( int ReviewID ) : void
ReviewID int
return void
示例#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);
        }
示例#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 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;

            }
        }