예제 #1
0
        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));
        }
예제 #2
0
        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();
            }
        }
    }