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; }
public AllRestore(Int32 projectVersionID, IRtpProjectRepository repo) { _repo = repo; _projectVersionID = projectVersionID; Amendment = new CycleAmendment(); Amendment = this.UpdateStatus(ref this.Amendment); }
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; }
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; }
public ApprovedDelete(CycleAmendment amendment, IRtpProjectRepository repo) { Amendment = amendment; ProjectRepository = repo; }
public PendingToAdopted(IRtpProjectRepository repo, CycleAmendment amendment) { RtpProjectRepository = repo; Amendment = this.UpdateStatus(amendment); }
public DeleteToSubmitted(IRtpProjectRepository repo, CycleAmendment amendment) { RtpProjectRepository = repo; Amendment = UpdateStatus(amendment); }
public DeleteStrategy(IRtpProjectRepository repo, CycleAmendment amendment) { _repo = repo; _amendment = amendment; }
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" }); }
/// <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); } }
public InProgressDelete(CycleAmendment amendment, IRtpProjectRepository repo) { _repo = repo; _amendment = amendment; }
public PendingDrop(CycleAmendment amendment, IRtpProjectRepository repo) { _repo = repo; _amendment = this.UpdateStatus(amendment); }
/* *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; }
protected CycleAmendment UpdateStatus(ref CycleAmendment amendment) { amendment.AmendmentStatusId = (int)Enums.RTPAmendmentStatus.Pending; amendment.VersionStatusId = (Int32)Enums.RTPVersionStatus.Pending; return amendment; }
public SubmittedToPending(IRtpProjectRepository repo, CycleAmendment amendment) { RtpProjectRepository = repo; Amendment = this.UpdateStatus(amendment); }