Пример #1
0
 protected CycleAmendment UpdateStatus(CycleAmendment amendment)
 {
     //set the Amendment Reason to "Deleting previous amendment"
     amendment.AmendmentStatusId = (Int32)Enums.RTPAmendmentStatus.Submitted;
     amendment.VersionStatusId = (Int32)Enums.RTPVersionStatus.Pending;
     return amendment;
 }
Пример #2
0
 public AllRestore(Int32 projectVersionID, IRtpProjectRepository repo)
 {
     _repo = repo;
     _projectVersionID = projectVersionID;
     Amendment = new CycleAmendment();
     Amendment = this.UpdateStatus(ref this.Amendment);
 }
Пример #3
0
        protected CycleAmendment UpdateStatus(CycleAmendment amendment)
        {
            if(amendment.VersionStatusId.Equals((Int32)Enums.RTPVersionStatus.Inactive))
            {
                amendment.VersionStatusId = (Int32)Enums.RTPVersionStatus.Pending;
                amendment.AmendmentStatusId = (Int32)Enums.RTPAmendmentStatus.Pending;
            }
            else amendment.VersionStatusId = (Int32)Enums.RTPVersionStatus.Inactive;

            return amendment;
        }
Пример #4
0
        protected CycleAmendment UpdateStatus(CycleAmendment amendment)
        {
            // need to check the database to see if the project version is new or from existing
            if (GetProjectHistory().Count() > 1 && GetProjectHistory().ElementAt(1).Value == (int)Enums.RTPAmendmentStatus.Submitted)
            {
                amendment.AmendmentStatusId = (int)Enums.RTPAmendmentStatus.Approved;
                pendingDeleteId = GetProjectHistory().ElementAt(1).Key;
            }
            else
            {
                amendment.AmendmentStatusId = (int)Enums.RTPAmendmentStatus.Amended;
            }

            amendment.VersionStatusId = (Int32)Enums.RTPVersionStatus.Active;
            return amendment;
        }
        public JsonResult DropAmendment(CycleAmendment amendment)
        {
            try
            {
                amendment.AmendmentStatusId = (int)Enums.RTPAmendmentStatus.Cancelled;

                IDeleteStrategy strategy = new DeleteStrategy(this._rtpProjectRepository, amendment).PickStrategy();
                strategy.Delete();
            }
            catch (Exception ex)
            {
                return Json(new
                {
                    message = "Changes could not be stored. An error has been logged."
                    ,
                    error = "true"
                    ,
                    exceptionMessage = ex.Message
                });
            }
            return Json(new
            {
                message = "Project successfully updated."
                ,
                error = "false"
            });
        }
        public ActionResult DeleteAmendment(Int32 projectVersionId, Int32 previousProjectVersionId)
        {
            //throw new NotImplementedException();
            CycleAmendment amendment = new CycleAmendment()
            {
                //LocationMapPath = _config.LocationMapPath,
                ProjectVersionId = projectVersionId
            };

            IDeleteStrategy strategy = new DeleteStrategy(this._rtpProjectRepository, amendment).PickStrategy();
            int returnId = strategy.Delete();
            previousProjectVersionId = !returnId.Equals(default(int)) ? returnId : previousProjectVersionId;

            if (!previousProjectVersionId.Equals(default(int)))
            {
                return RedirectToAction("Details", new { controller = "RtpProject", id = previousProjectVersionId });
            }

            string returnUrl = HttpContext.Request.UrlReferrer.PathAndQuery ?? String.Empty;

            if (!String.IsNullOrEmpty(returnUrl))
            {
                return Redirect(returnUrl);
            }
            return RedirectToAction("Index", new { controller = "Rtp", year = String.Empty });
        }
        public ICollection<CycleAmendment> GetCollectionOfCycles(int timePeriodId, Enums.RTPCycleStatus? status)
        {
            SqlCommand cmd = new SqlCommand("[RTP].[GetCurrentPlanCycle]");
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@TimePeriodId", timePeriodId);
            if (status.HasValue)
            {
                cmd.Parameters.AddWithValue("@StatusId", (int)status);
            }

            var result = new List<CycleAmendment>();
            CycleAmendment cycle = null;

            using (IDataReader rdr = this.ExecuteReader(cmd))
            {
                while (rdr.Read())
                {
                    cycle = new CycleAmendment()
                    {
                        Id = rdr["id"] != DBNull.Value ? rdr["id"].ToString().SmartParse<int>() : default(int)
                        ,
                        Name = rdr["cycle"].ToString()
                        ,
                        StatusId = rdr["statusId"].ToString().SmartParseDefault<int>(default(int))
                        ,
                        NextCycleId = rdr["nextCycleId"].ToString().SmartParseDefault<int>(default(int))
                        ,
                        NextCycleName = rdr["nextCycle"].ToString()
                        ,
                        NextCycleStatus = rdr["nextCycleStatus"].ToString()

                    };
                    cycle.Status = StringEnum.GetStringValue((Enums.RTPCycleStatus)cycle.StatusId);
                    result.Add(cycle);
                }
            }

            return result;
        }
Пример #8
0
 public ApprovedDelete(CycleAmendment amendment, IRtpProjectRepository repo)
 {
     Amendment = amendment;
     ProjectRepository = repo;
 }
Пример #9
0
 public PendingToAdopted(IRtpProjectRepository repo, CycleAmendment amendment)
 {
     RtpProjectRepository = repo;
     Amendment = this.UpdateStatus(amendment);
 }
Пример #10
0
 public DeleteToSubmitted(IRtpProjectRepository repo, CycleAmendment amendment)
 {
     RtpProjectRepository = repo;
     Amendment = UpdateStatus(amendment);
 }
Пример #11
0
 public DeleteStrategy(IRtpProjectRepository repo, CycleAmendment amendment)
 {
     _repo = repo;
     _amendment = amendment;
 }
Пример #12
0
 public JsonResult Amend(int projectVersionId, int cycleId)
 {
     int result = default(int);
     CycleAmendment amendment = new CycleAmendment() { ProjectVersionId = projectVersionId, Id = cycleId };
     try
     {
         IAmendmentStrategy strategy = new AmendmentStrategy(_rtpProjectRepository, amendment).PickStrategy();
         result = strategy.Amend();
         //result = RtpProjectRepository.DeleteProjectVersion(projectVersionId, RTPAmendmentStatus.Submitted);
     }
     catch (Exception ex)
     {
         return Json(new
         {
             message = "Changes could not be stored. An error has been logged."
             ,
             error = "true"
             ,
             exceptionMessage = ex.Message
         });
     }
     return Json(new
     {
         data = result
         ,
         message = "Project successfully amended."
         ,
         error = "false"
     });
 }
Пример #13
0
 /// <summary>
 /// Update a project's Amendment Status
 /// </summary>
 /// <param name="model"></param>
 public void UpdateProjectAmendmentStatus(CycleAmendment model)
 {
     using (SqlCommand command = new SqlCommand("[RTP].[UpdateProjectAmendmentStatus]") { CommandType = CommandType.StoredProcedure })
     {
         command.Parameters.AddWithValue("@ProjectVersionId", model.ProjectVersionId);
         command.Parameters.AddWithValue("@AmendmentStatusId", model.AmendmentStatusId);
         command.Parameters.AddWithValue("@VersionStatusId", model.VersionStatusId);
         this.ExecuteNonQuery(command);
     }
 }
Пример #14
0
 public InProgressDelete(CycleAmendment amendment, IRtpProjectRepository repo)
 {
     _repo = repo;
     _amendment = amendment;
 }
Пример #15
0
 public PendingDrop(CycleAmendment amendment, IRtpProjectRepository repo)
 {
     _repo = repo;
     _amendment = this.UpdateStatus(amendment);
 }
Пример #16
0
 /*
     *Get Current Amendment Status
      * Does project need to be copied?
      * Amend Project
      * Check if Previous Active Amendment needs to be changed to inactive
      * Return to details page
 */
 public AmendmentStrategy(IRtpProjectRepository repo, CycleAmendment amendment)
 {
     RtpProjectRepository = repo;
     Amendment = amendment;
 }
Пример #17
0
 protected CycleAmendment UpdateStatus(ref CycleAmendment amendment)
 {
     amendment.AmendmentStatusId = (int)Enums.RTPAmendmentStatus.Pending;
     amendment.VersionStatusId = (Int32)Enums.RTPVersionStatus.Pending;
     return amendment;
 }
Пример #18
0
 public SubmittedToPending(IRtpProjectRepository repo, CycleAmendment amendment)
 {
     RtpProjectRepository = repo;
     Amendment = this.UpdateStatus(amendment);
 }