public FinalDecisionViewModel(ScreeningRequestPersonFinalDecision srpfd) { if (srpfd != null) { this.Id = srpfd.Id; this.RequestPersonID = srpfd.RequestPerson.Id; this.ScreeningResultID = srpfd.ScreeningResult.Id; this.ScreeningSupportStatusID = srpfd.ScreeningSupportStatus.Id; this.Commentary = srpfd.Commentary; this.Version = srpfd.Version; } }
public ActionResult RequestAction(FinalizeViewModel vm) { if (ModelState.IsValid) { // update commentary foreach (FinalDecisionViewModel fdvm in vm.FinalDecisions.Values) { ScreeningRequestPersonFinalDecision srpfd; if (fdvm.Id > 0) { srpfd = this.screeningTasks.GetFinalDecision(fdvm.Id); } else { srpfd = new ScreeningRequestPersonFinalDecision(); } if (srpfd.Version > fdvm.Version) { ModelState.AddModelError("somekey", "Data has changed since you loaded this page. Please reload before saving again. Try pressing the back button to recover your edits."); return(RequestAction(vm)); } srpfd.Commentary = fdvm.Commentary; srpfd.Version = fdvm.Version; srpfd.RequestPerson = this.requestPersonTasks.GetRequestPerson(fdvm.RequestPersonID); srpfd.ScreeningResult = this.screeningTasks.GetScreeningResult(fdvm.ScreeningResultID); srpfd.ScreeningSupportStatus = this.screeningTasks.GetScreeningSupportStatus(fdvm.ScreeningSupportStatusID); this.screeningTasks.SaveOrUpdateFinalDecision(srpfd, User.Identity.Name); } if (vm.Finalize) { ViewBag.SuccessMessage = "Screening request complete."; // update status this.requestTasks.SaveRequestHistory(vm.Id, this.requestTasks.GetRequestStatus(RequestStatus.NAME_COMPLETED).Id, User.Identity.Name); // send email notification this.emailTasks.SendRequestCompletedEmail(User.Identity.Name, vm.Id); return(RedirectToAction("Index")); } else { // redirecting instead of calling RequestAction directly, as this starts a new transaction. // this is needed for the Version column validation to work properly. return(RedirectToAction("RequestAction", new { id = vm.Id })); } } return(RequestAction(vm.Id)); }
public void CreateScreeningRequestPersonFinalDecisionsForRequest(Request request, string username) { if (request != null) { ScreeningResult screeningResult = this.GetScreeningResult(ScreeningResult.PENDING); ScreeningSupportStatus screeningSupportStatus = this.GetScreeningSupportStatus(ScreeningSupportStatus.ID_PENDING); foreach (RequestPerson rp in request.Persons.Where(x => !x.Archive)) { // only create new ScreeningRequestPersonFinalDecision if one doesn't already exist if (rp.GetScreeningRequestPersonFinalDecision() == null) { // persist new ScreeningRequestPersonFinalDecision for this RequestPerson ScreeningRequestPersonFinalDecision finalDecision = new ScreeningRequestPersonFinalDecision() { RequestPerson = rp, ScreeningResult = screeningResult, ScreeningSupportStatus = screeningSupportStatus }; // copy screening result made during recommendation/consolidation phase ScreeningRequestPersonRecommendation recommendation = rp.GetScreeningRequestPersonRecommendation(); if (recommendation != null && recommendation.ScreeningResult != null) { finalDecision.ScreeningResult = recommendation.ScreeningResult; // use same level screening result to pre-populate support status as well switch (recommendation.ScreeningResult.Id) { case ScreeningResult.ID_GREEN: finalDecision.ScreeningSupportStatus = this.GetScreeningSupportStatus(ScreeningSupportStatus.ID_SUPPORT_RECOMMENDED); break; case ScreeningResult.ID_YELLOW: finalDecision.ScreeningSupportStatus = this.GetScreeningSupportStatus(ScreeningSupportStatus.ID_MONITORED_SUPPORT); break; case ScreeningResult.ID_RED: finalDecision.ScreeningSupportStatus = this.GetScreeningSupportStatus(ScreeningSupportStatus.ID_SUPPORT_NOT_RECOMMENDED); break; case ScreeningResult.ID_PENDING: finalDecision.ScreeningSupportStatus = this.GetScreeningSupportStatus(ScreeningSupportStatus.ID_PENDING); break; } } finalDecision = this.SaveOrUpdateFinalDecision(finalDecision, username); rp.AddScreeningRequestPersonFinalDecision(finalDecision); } } } }
public ScreeningRequestPersonFinalDecision SaveOrUpdateFinalDecision(ScreeningRequestPersonFinalDecision srpfd, string username) { srpfd = this.srpfdRepo.SaveOrUpdate(srpfd); ScreeningRequestPersonFinalDecisionHistory h = new ScreeningRequestPersonFinalDecisionHistory(); h.AdminUser = this.userTasks.GetAdminUser(username); h.DateStatusReached = DateTime.Now; h.ScreeningRequestPersonFinalDecision = srpfd; h.ScreeningStatus = (srpfd.Id > 0 ? this.screeningStatusRepo.Get(ScreeningStatus.UPDATED) : this.screeningStatusRepo.Get(ScreeningStatus.ADDED)); this.srpfdhRepo.SaveOrUpdate(h); return(srpfd); }
public JsonNetResult Reasons() { string term = Request.QueryString["term"]; if (!string.IsNullOrEmpty(term)) { term = term.Trim(); Regex regex = new Regex("^[0-9]+$"); if (regex.IsMatch(term)) { int requestPersonId; if (int.TryParse(term, out requestPersonId)) { RequestPerson rp = this.requestPersonTasks.GetRequestPerson(requestPersonId); if (rp != null && rp.Request != null) { AdminUser user = this.userTasks.GetAdminUser(User.Identity.Name); // 2014-09-01 we used to check request.UserHasPermission(user) at this point, but actually there are no restrictions // on access for any of the roles that have access to this action anyway, so - no check. IList <object> reasons = new List <object>(); // conditionality participant inputs foreach (ScreeningEntity se in this.screeningTasks.GetScreeningEntities()) { ScreeningRequestPersonEntity srpe = rp.GetScreeningRequestPersonEntity(se.ScreeningEntityName); if (srpe != null) { reasons.Add(new { ScreeningEntity = srpe.ScreeningEntity.ToString(), Result = srpe.ScreeningResult.ToString(), Reason = srpe.Reason, Commentary = srpe.Commentary }); } } // consolidation phase commentary ScreeningRequestPersonRecommendation srpr = rp.GetScreeningRequestPersonRecommendation(); if (srpr != null) { reasons.Add(new { ScreeningEntity = "PWG", Result = srpr.ScreeningResult.ToString(), Commentary = srpr.Commentary }); } // final decision commentary ScreeningRequestPersonFinalDecision srpfd = rp.GetScreeningRequestPersonFinalDecision(); if (srpfd != null) { reasons.Add(new { ScreeningEntity = "SMG", Result = srpfd.ScreeningResult.ToString(), SupportStatus = srpfd.ScreeningSupportStatus.ToString(), Commentary = srpfd.Commentary }); } return(JsonNet(reasons)); } } } } return(JsonNet(string.Empty)); }
public RequestPersonViewModel(RequestPerson rp) { this.Id = rp.Id; this.Notes = rp.Notes; if (rp.Request != null) { this.RequestId = rp.Request.Id; this.RequestName = rp.Request.Headline; } this.EntityResults = new List <ScreeningResultViewModel>(); string[] entities = ScreeningEntity.GetNames(rp.Request.GetCreatedDate()); foreach (string entity in entities) { ScreeningRequestPersonEntity srpe = rp.GetScreeningRequestPersonEntity(entity); if (srpe != null) { this.EntityResults.Add(new ScreeningResultViewModel() { Name = srpe.ScreeningEntity.ToString(), Result = srpe.ScreeningResult.ToString(), Reason = srpe.Reason, Commentary = srpe.Commentary, Date = srpe.MostRecentHistory.DateStatusReached }); } else { this.EntityResults.Add(new ScreeningResultViewModel() { Name = entity }); } } ScreeningRequestPersonRecommendation srpr = rp.GetScreeningRequestPersonRecommendation(); if (srpr != null) { this.RecommendationResult = new ScreeningResultViewModel() { Name = "Recommended", Result = srpr.ScreeningResult.ToString(), Commentary = srpr.Commentary, Date = srpr.MostRecentHistory.DateStatusReached } } ; ScreeningRequestPersonFinalDecision srpfd = rp.GetScreeningRequestPersonFinalDecision(); if (srpfd != null) { this.FinalResult = new ScreeningResultViewModel() { Name = "Final Decision", Result = srpfd.ScreeningResult.ToString(), Commentary = srpfd.Commentary, Date = srpfd.MostRecentHistory.DateStatusReached }; this.FinalSupportStatus = srpfd.ScreeningSupportStatus.ToString(); } } }
public virtual void AddScreeningRequestPersonFinalDecision(ScreeningRequestPersonFinalDecision srpfd) { this.ScreeningRequestPersonFinalDecisions.Add(srpfd); }
/// <summary> /// Sets a row in the person attached /// </summary> /// <param name="row">The row that has already been added to the persons attached table</param> /// <param name="person">The person whose details should be added to the row</param> /// <returns>Pdf row object</returns> private Row SetPersonAttachedRow(Row row, RequestPerson rp, ScreeningRequestPersonFinalDecision srpfd, int rowNum) { Text text; Cell cell; TextInfo textInfo = new TextInfo(); row.VerticalAlignment = VerticalAlignmentType.Top; row.IsBroken = false; //text customization for labels in request details textInfo.FontSize = 12; textInfo.IsTrueTypeFontBold = false; textInfo.Alignment = AlignmentType.Center; cell = row.Cells.Add(rowNum.ToString(), textInfo); //Career Column IList <Career> careers = this.requestPersonTasks.GetHistoricalCurrentCareers(rp, false); string functions = string.Empty; string rank = string.Empty; if (careers != null && careers.Any()) { IEnumerable <string> list = careers.Select(x => x.FunctionUnitSummary); functions = string.Join("; ", list.Where(x => !string.IsNullOrEmpty(x))); if (careers.First().Rank != null) { rank = careers.First().Rank.ToString(); } } cell = row.Cells.Add(functions, textInfo); cell = row.Cells.Add(rank, textInfo); //Name Column //personName = (person.IsProposed) ? person.PersonName + " (proposed)" : person.PersonName; cell = row.Cells.Add(rp.Person.Name.Trim(), textInfo); //Military ID Column cell = row.Cells.Add(rp.Person.MilitaryIDNumber, textInfo); //Support Status Column string status = string.Empty; if (srpfd != null) { status = srpfd.ScreeningSupportStatus.ToString(); } cell = row.Cells.Add(); text = new Text(status); //if (!System.String.IsNullOrEmpty(person.ScreeningSupportStatus)) //{ //Support Recommended //if (person.ScreeningSupportStatus.Equals("Support Recommended", StringComparison.OrdinalIgnoreCase)) //{ //text.TextInfo.BackgroundColor = new Color("Green"); //text.TextInfo.Color = new Color("White"); //} //Support Not Recommended //else if (person.ScreeningSupportStatus.Equals("Support Not Recommended", StringComparison.OrdinalIgnoreCase)) //{ //text.TextInfo.BackgroundColor = new Color("Red"); //text.TextInfo.Color = new Color("White"); //} //Monitored Support //else //{ //} //} text.TextInfo.Alignment = AlignmentType.Center; //text.TextInfo.LineSpacing = 6; cell.Paragraphs.Add(text); return(row); }