Ejemplo n.º 1
0
        protected void AdsRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var jobAdId = new Guid((string)e.CommandArgument);
            var jobAd   = _jobAdsQuery.GetJobAd <JobAd>(jobAdId);

            if (jobAd == null)
            {
                throw new ArgumentException("No job ad with ID " + jobAdId + " was found.");
            }

            string message;

            switch (e.CommandName)
            {
            case OpenAdCommand:
                if (_jobAdsCommand.CanBeOpened(jobAd))
                {
                    message = JobAdFacade.ReopenJobAd(LoggedInEmployer, jobAd);
                    OnJobAdRemoved(e.Item.ItemIndex, message);
                }
                else
                {
                    // Reposting - simply redirect to the Purchase Preview page and take the reposting workflow from there.

                    message = "Please review the ad before publishing it.";
                    var quantity = _employerCreditsQuery.GetEffectiveActiveAllocation <JobAdCredit>(LoggedInEmployer).RemainingQuantity;
                    if (quantity != null && quantity > 0)
                    {
                        message = "Reposting this ad will use one credit. " + message;
                    }

                    var previewUrl = JobAdsRoutes.Preview.GenerateUrl(new { jobAdId = jobAd.Id });
                    RedirectWithNotification(previewUrl, NotificationType.Information, message);
                }
                break;

            case CloseAdCommand:
                message = CloseJobAd(jobAd);
                OnJobAdRemoved(e.Item.ItemIndex, message);
                break;

            case DeleteDraftCommand:
                message = DeleteDraftAd(jobAd);
                OnJobAdRemoved(e.Item.ItemIndex, message);
                break;

            default:
                throw new ApplicationException("Unexpected command");
            }
        }
Ejemplo n.º 2
0
        protected string GetStatusText(Application application)
        {
            if (application == null)
            {
                return(string.Empty);
            }

            if (application is ExternalApplication)
            {
                return("Managed externally");
            }

            var internalApplication = (InternalApplication)application;
            var status = _jobAdApplicantsQuery.GetApplicantStatus(application.Id);

            switch (status)
            {
            case ApplicantStatus.New:

                var jobAd = _jobAds[application.PositionId];
                if (jobAd.Processing != JobAdProcessing.ManagedInternally)
                {
                    if (internalApplication.IsPending && !string.IsNullOrEmpty(jobAd.Integration.ExternalApplyUrl))
                    {
                        var applyLink = GetPopupATag(jobAd.GetExternalApplyUrl(internalApplication.Id), JobAdFacade.GetExternalApplyPopupWindowName(jobAd), "Complete application");
                        return("Pending (external site)" + StringUtils.HTML_LINE_BREAK + applyLink);
                    }
                    return("Managed externally");
                }

                return("New");

            case ApplicantStatus.Shortlisted:
                return("Shortlisted");

            case ApplicantStatus.Rejected:
                return("Declined");

            default:
                return("Managed externally");
            }
        }