예제 #1
0
        private CandidateListRecoveryModel GetRecovery(CandidateListModel searchList)
        {
            const string method = "GetRecovery";

            try
            {
                // Get spelling suggestions if needed.

                var spellingSuggestions = searchList.Results.TotalCandidates <= Reference.SpellingThreshold
                    ? _memberSearchSuggestionsQuery.GetSpellingSuggestions(searchList.Criteria)
                    : null;

                // Get more results only if there are no spelling suggestions.

                var moreResultsSuggestions = searchList.Results.TotalCandidates <= Reference.MoreResultsThreshold && spellingSuggestions.IsNullOrEmpty()
                    ? _memberSearchSuggestionsQuery.GetMoreResultsSuggestions(searchList.Criteria)
                    : null;

                return(!spellingSuggestions.IsNullOrEmpty() || !moreResultsSuggestions.IsNullOrEmpty()
                    ? new CandidateListRecoveryModel {
                    SpellingSuggestions = spellingSuggestions, MoreResultsSuggestions = moreResultsSuggestions
                }
                    : null);
            }
            catch (Exception ex)
            {
                // Don't let a recovery failure cause the entire request to fail.

                EventSource.Raise(Event.Warning, method, "Cannot get the recovery for a search.", ex, new StandardErrorHandler());
                return(null);
            }
        }
 public static string GetPageTitle(this CandidateListModel model)
 {
     return(model is BrowseListModel
         ? "Find "
            + ((BrowseListModel)model).SalaryBand.GetSalaryBandDisplayText()
            + " candidates in "
            + ((BrowseListModel)model).Location.Name
         : "Jobs - Online Job Search for Jobs, Employment &amp; Careers in Australia");
 }
        public IResult CheckForStartInterview(CandidateListModel candidate)
        {
            var result = new Result
            {
                Operation = Operation.Read,
                Status    = Status.Success
            };

            try
            {
                var userId = GenericHelper.GetUserClaimDetails((ClaimsIdentity)_principal.Identity).UserId;
                result.Body = _approvalRepository.CheckForStartInterview(candidate.CandidateId, candidate.ApprovalEventId, userId);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                result.Status  = Status.Error;
            }
            return(result);
        }
예제 #4
0
        public IResult GetCandidatesCorrespondingToLoggedUser(Guid userId)
        {
            var result = new Result
            {
                Operation = Operation.Read,
                Status    = Status.Success
            };

            try
            {
                var allScheduleUserForCandiadate = _candidateRepository.GetCandidatesCorrespondingToLoggedUser(userId);
                var candidateList = allScheduleUserForCandiadate.Select(scheduleUser =>
                {
                    var openingCandidate   = _candidateRepository.GetOpeningCandidate(scheduleUser.CandidateId);
                    var candidateListModel = new CandidateListModel();
                    if (openingCandidate != null)
                    {
                        candidateListModel.Opening      = openingCandidate.Opening.Title;
                        candidateListModel.ModifiedDate = openingCandidate.Opening.ModifiedDate;
                    }

                    var approvalTransaction = _approvalRepository.GetApprovalTransactionByEntity(scheduleUser.CandidateId);

                    candidateListModel.Status = approvalTransaction == null ? "Created" : approvalTransaction.ApprovalAction.ApprovalActionName;

                    candidateListModel.ApprovalEventId = scheduleUser.ApprovalEventId;
                    candidateListModel.IsFinished      = _candidateRepository.CheckForInterviewCompletion(scheduleUser);
                    return(candidateListModel.MapFromModel(scheduleUser.Candidate));
                }).ToList();
                List <CandidateListModel> candidateListViewModel = candidateList.Cast <CandidateListModel>().ToList();
                result.Body = candidateListViewModel.OrderByDescending(x => x.ModifiedDate);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                result.Status  = Status.Error;
            }
            return(result);
        }
예제 #5
0
        public IResult GetAllCandidate()
        {
            var result = new Result
            {
                Operation = Operation.Read,
                Status    = Status.Success
            };

            try
            {
                var allCandidates = _candidateRepository.GetAll();
                var candidateList = allCandidates.Select(candidate =>
                {
                    var openingCandidate   = _candidateRepository.GetOpeningCandidate(candidate.CandidateId);
                    var candidateListModel = new CandidateListModel();
                    if (openingCandidate != null)
                    {
                        candidateListModel.Opening      = openingCandidate.Opening.Title;
                        candidateListModel.ModifiedDate = openingCandidate.Opening.ModifiedDate;
                    }

                    var assignedUsers = _candidateRepository.GetAssignedUsersByID(candidate.CandidateId);
                    candidateListModel.AssignedUsers = assignedUsers.Count;
                    candidateListModel.Documents     = candidate.CandidateDocuments.Count;
                    var approvalTransaction          = _approvalRepository.GetApprovalTransactionByEntity(candidate.CandidateId);
                    candidateListModel.Status        = approvalTransaction == null ? "Created" : approvalTransaction.ApprovalAction.ApprovalActionName;

                    return(candidateListModel.MapFromModel(candidate));
                }).ToList();
                List <CandidateListModel> candidateListViewModel = candidateList.Cast <CandidateListModel>().ToList();
                result.Body = candidateListViewModel.OrderByDescending(x => x.ModifiedDate);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                result.Status  = Status.Error;
            }
            return(result);
        }
예제 #6
0
        private void SaveSearch(SearchContext context, IHasId <Guid> employer, CandidateListModel searchList, int page, Guid?savedSearchId)
        {
            try
            {
                var userAgent = HttpContext.Request.UserAgent;

                //never log monitoring calls
                if (!string.IsNullOrEmpty(userAgent) && userAgent.Contains("LinkmeMonitoring"))
                {
                    return;
                }

                var app       = ActivityContext.Channel.App;
                var execution = new MemberSearchExecution
                {
                    Context  = context.ToString(),
                    Criteria = searchList.Criteria.Clone(),
                    Results  = new MemberSearchResults
                    {
                        MemberIds    = page == 1 ? searchList.Results.CandidateIds : new Guid[0],
                        TotalMatches = searchList.Results.TotalCandidates
                    },
                    SearcherId = employer == null ? (Guid?)null : employer.Id,
                    SearchId   = savedSearchId,
                    ChannelId  = app.ChannelId,
                    AppId      = app.Id,
                    StartTime  = DateTime.Now,
                };

                _memberSearchesCommand.CreateMemberSearchExecution(execution);
            }
            catch (Exception)
            {
                // Never fail for this.
            }
        }
        public IResult CheckForStartInterview([FromBody] CandidateListModel candidate)
        {
            var NextEventOrder = _approvalManager.CheckForStartInterview(candidate);

            return(NextEventOrder);
        }
 public static string GetFlagHolderCssClass(this CandidateListModel model)
 {
     return(model is ManageCandidatesListModel ? "manage-candidate" : "");
 }
 public static bool GetBlockCandidatePermanently(this CandidateListModel model)
 {
     return(model is ManageCandidatesListModel);
 }
예제 #10
0
 public static string GetPaginationResultsSuffix(this CandidateListModel model)
 {
     return(model is SuggestedCandidatesListModel
         ? " matching your job ad"
         : "");
 }
예제 #11
0
 public static string GetPaginationResultsText(this CandidateListModel model)
 {
     return(model is SuggestedCandidatesListModel || model is ManageCandidatesListModel
         ? "Candidates"
         : "Results");
 }
예제 #12
0
 public static string GetHash(this CandidateListModel model)
 {
     return(model.GetType() == typeof(SearchListModel)
         ? model.Criteria.GetHash()
         : null);
 }
예제 #13
0
 public static bool SetHash(this CandidateListModel model)
 {
     return(model.GetType() == typeof(SearchListModel));
 }