public JsonResult IsJobApplied(int jobId) { try { IGetJobListingRequest jobListingRequest = new JXTNext_GetJobListingRequest { JobID = jobId }; IGetJobListingResponse jobListingResponse = _BLConnector.GuestGetJob(jobListingRequest); long expiryDate = (long)DateTime.Now.ToUniversalTime().Subtract(UnixEpoch).TotalMilliseconds; bool isJobExpired = false; if (jobListingResponse.Job != null && jobListingResponse.Job.ExpiryDate <= expiryDate) { isJobExpired = true; } bool isJobApplied = _isMemberAppliedJob(jobId); var result = new { IsJobExpired = isJobExpired, IsJobApplied = isJobApplied }; return(new JsonResult { Data = result }); } catch (Exception ex) { Log.Write($"IsJobApplied exception = " + ex.Message, ConfigurationPolicy.ErrorLog); var result = new { Error = true }; return(new JsonResult { Data = result }); } }
public JobViewModel GetSingleViewModel(int id) { IGetJobListingRequest jobListingRequest = new JXTNext_GetJobListingRequest { JobID = id }; IGetJobListingResponse jobListingResponse = _jxtBLConnector.AdvertiserGetJob(jobListingRequest); if (jobListingResponse.Job == null) { return(null); } return(this.GetVM(jobListingResponse.Job)); }
// GET: JobSearchResults public ActionResult Index([ModelBinder(typeof(JobSearchResultsFilterBinder))] JobSearchResultsFilterModel filterModel, int?jobId) { dynamic dynamicJobResultsList = null; if (filterModel != null && !string.IsNullOrEmpty(filterModel.Keywords)) { filterModel.Keywords = filterModel.Keywords.Trim(); //filterModel.Keywords = filterModel.Keywords.Trim(charsToTrim); } if (jobId.HasValue) { IGetJobListingRequest jobListingRequest = new JXTNext_GetJobListingRequest { JobID = jobId.Value }; IGetJobListingResponse jobListingResponse = _BLConnector.GuestGetJob(jobListingRequest); var jobDetails = jobListingResponse.Job; var classificationTopLevelId = jobListingResponse.Job.CustomData["Classifications[0].Filters[0].ExternalReference"]; JobSearchResultsFilterModel filterModelNew = new JobSearchResultsFilterModel() { Filters = new List <JobSearchFilterReceiver>() }; JobSearchFilterReceiverItem filterReceiverItem = new JobSearchFilterReceiverItem() { ItemID = classificationTopLevelId }; JobSearchFilterReceiver filterReceiver = new JobSearchFilterReceiver() { rootId = "Classifications", values = new List <JobSearchFilterReceiverItem>() }; filterReceiver.values.Add(filterReceiverItem); filterModelNew.Filters.Add(filterReceiver); ISearchJobsResponse response = GetJobSearchResultsResponse(filterModelNew); JXTNext_SearchJobsResponse jobResultsList = response as JXTNext_SearchJobsResponse; jobResultsList.SearchResults.RemoveAll(item => item.JobID == jobId.Value); dynamicJobResultsList = jobResultsList as dynamic; } else if (filterModel != null) { filterModel = _processWidgetConfiguredFilter(filterModel); ISearchJobsResponse response = GetJobSearchResultsResponse(filterModel); dynamicJobResultsList = response as dynamic; } return(View(this.TemplateName, dynamicJobResultsList)); }
private JobDetailsModel GetJobDetails(int jobid) { IGetJobListingRequest jobListingRequest = new JXTNext_GetJobListingRequest { JobID = jobid }; IGetJobListingResponse jobListingResponse = _blConnector.GuestGetJob(jobListingRequest); ViewBag.JobTitle = jobListingResponse.Job.Title; JobDetailsModel jobDetails = new JobDetailsModel(); jobDetails.ApplicationEmail = jobListingResponse.Job.CustomData["ApplicationMethod.ApplicationEmail"]; jobDetails.ContactDetails = jobListingResponse.Job.CustomData["ContactDetails"]; jobDetails.CompanyName = jobListingResponse.Job.CustomData["CompanyName"]; jobDetails.JobLocation = jobListingResponse.Job.CustomData["CountryLocationArea[0].Filters[0].Value"]; jobDetails.JobSEOUrl = jobListingResponse.Job?.ClassificationURL; return(jobDetails); }
private JobDetailsFullModel _GetRequestedJob(int jobId) { try { var jobListingRequest = new JXTNext_GetJobListingRequest { JobID = jobId }; var jobListingResponse = _BLConnector.GuestGetJob(jobListingRequest); return(jobListingResponse.Job); } catch { } return(null); }
public IGetJobListingResponse GuestGetJob(IGetJobListingRequest jobDetails) { JXTNext_GetJobListingRequest jobRequest = jobDetails as JXTNext_GetJobListingRequest; ConnectorGetRequest connectorRequest = new ConnectorGetRequest(HTTP_Requests_MaxWaitTime) { HeaderValues = HTTP_Request_HeaderValues, TargetUri = new Uri(CONFIG_DataAccessTarget + $"/api/guest/job/{jobRequest.JobID}") }; ConnectorResponse response = JXTNext.Common.API.Connector.Get(connectorRequest); //parse the response bool actionSuccessful = response.Success; if (actionSuccessful) { dynamic responseObj = JObject.Parse(response.Response); if (responseObj["status"] == 200) { JObject jobItem = JObject.Parse(responseObj["data"].Value); return(new JXTNext_GetJobListingResponse { Success = true, Job = _jobMapper.ConvertToLocalEntity <JobDetailsFullModel>(jobItem) }); } else { return new JXTNext_GetJobListingResponse { Success = false, Errors = JsonConvert.DeserializeObject <List <string> >(responseObj["errors"].ToString()) } }; } else { return new JXTNext_GetJobListingResponse { Success = false, Errors = new List <string> { response.Response } } }; }
// GET: JobDetails public ActionResult Index(int?jobId) { JobDetailsViewModel viewModel = new JobDetailsViewModel(); if (jobId.HasValue) { // Get job source or url referral string UrlReferral = string.Empty; if (!string.IsNullOrWhiteSpace(Request.QueryString["source"])) { UrlReferral = Request.QueryString["source"]; } else { UrlReferral = this.GetCookieDomain(Request.Cookies["JobsViewed"], jobId.Value); } viewModel.UrlReferral = UrlReferral; Log.Write($" viewModel.UrlReferral : " + viewModel.UrlReferral, ConfigurationPolicy.ErrorLog); IGetJobListingRequest jobListingRequest = new JXTNext_GetJobListingRequest { JobID = jobId.Value }; IGetJobListingResponse jobListingResponse = _BLConnector.GuestGetJob(jobListingRequest); if (jobListingResponse.Job != null && !jobListingResponse.Job.IsDeleted) { viewModel.JobDetails = jobListingResponse.Job; // Getting Consultant Avatar Image Url from Sitefinity viewModel.ApplicationEmail = jobListingResponse.Job.CustomData["ApplicationMethod.ApplicationEmail"]; var user = SitefinityHelper.GetUserByEmail(jobListingResponse.Job.CustomData["ApplicationMethod.ApplicationEmail"]); if (user != null && user.Id != Guid.Empty) { viewModel.ApplicationAvatarImageUrl = SitefinityHelper.GetUserAvatarUrlById(user.Id); } if (this.Model.IsJobApplyAvailable()) { viewModel.JobApplyAvailable = true; } // Processing Classifications OrderedDictionary classifOrdDict = new OrderedDictionary(); classifOrdDict.Add(jobListingResponse.Job.CustomData["Classifications[0].Filters[0].ExternalReference"], jobListingResponse.Job.CustomData["Classifications[0].Filters[0].Value"]); string parentClassificationsKey = "Classifications[0].Filters[0].SubLevel[0]"; JobDetailsViewModel.ProcessCustomData(parentClassificationsKey, jobListingResponse.Job.CustomData, classifOrdDict); OrderedDictionary classifParentIdsOrdDict = new OrderedDictionary(); JobDetailsViewModel.AppendParentIds(classifOrdDict, classifParentIdsOrdDict); var bull = jobListingResponse.Job.CustomData["Bulletpoints.BulletPoint1"]; // Processing Locations OrderedDictionary locOrdDict = new OrderedDictionary(); locOrdDict.Add(jobListingResponse.Job.CustomData["CountryLocationArea[0].Filters[0].ExternalReference"], jobListingResponse.Job.CustomData["CountryLocationArea[0].Filters[0].Value"]); string parentLocKey = "CountryLocationArea[0].Filters[0].SubLevel[0]"; JobDetailsViewModel.ProcessCustomData(parentLocKey, jobListingResponse.Job.CustomData, locOrdDict); OrderedDictionary locParentIdsOrdDict = new OrderedDictionary(); JobDetailsViewModel.AppendParentIds(locOrdDict, locParentIdsOrdDict); DateTime localTime = TimeZoneInfo.ConvertTimeFromUtc(ConversionHelper.GetDateTimeFromUnix(jobListingResponse.Job.DateCreated), TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time")); DateTime utcTime = ConversionHelper.GetDateTimeFromUnix(jobListingResponse.Job.DateCreated); DateTime elocalTime; DateTime eutcTime = new DateTime(); TimeSpan offset = localTime - utcTime; TimeSpan eoffset = new TimeSpan(); if (jobListingResponse.Job.ExpiryDate.HasValue) { elocalTime = TimeZoneInfo.ConvertTimeFromUtc(ConversionHelper.GetDateTimeFromUnix(jobListingResponse.Job.ExpiryDate.Value), TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time")); eutcTime = ConversionHelper.GetDateTimeFromUnix(jobListingResponse.Job.ExpiryDate.Value); eoffset = elocalTime - eutcTime; } viewModel.Classifications = classifParentIdsOrdDict; viewModel.Locations = locParentIdsOrdDict; viewModel.ClassificationsRootName = "Classifications"; viewModel.LocationsRootName = "CountryLocationArea"; var siteSettingsHelper = new SiteSettingsHelper(); viewModel.JobCurrencySymbol = siteSettingsHelper.GetJobCurrencySymbol(); // Getting the SEO route name for classifications List <string> seoString = new List <string>(); foreach (var key in classifParentIdsOrdDict.Keys) { string value = classifParentIdsOrdDict[key].ToString(); string SEOString = Regex.Replace(value, @"([^\w]+)", "-"); seoString.Add(SEOString); } viewModel.ClassificationsSEORouteName = jobListingResponse.Job.ClassificationURL; ViewBag.CssClass = this.CssClass; ViewBag.JobApplicationPageUrl = SfPageHelper.GetPageUrlById(JobApplicationPageId.IsNullOrWhitespace() ? Guid.Empty : new Guid(JobApplicationPageId)); ViewBag.JobResultsPageUrl = SfPageHelper.GetPageUrlById(JobResultsPageId.IsNullOrWhitespace() ? Guid.Empty : new Guid(JobResultsPageId)); ViewBag.EmailJobPageUrl = SfPageHelper.GetPageUrlById(EmailJobPageId.IsNullOrWhitespace() ? Guid.Empty : new Guid(EmailJobPageId)); ViewBag.GoogleForJobs = ReplaceToken(GoogleForJobsTemplate, JsonConvert.SerializeObject(new { CurrencySymbol = "$", SalaryLowerBand = jobListingResponse.Job.CustomData.ContainsKey("Salaries[0].Filters[0].Min") ? jobListingResponse.Job.CustomData["Salaries[0].Filters[0].Min"] : null, SalaryUpperBand = jobListingResponse.Job.CustomData.ContainsKey("Salaries[0].Filters[0].Max") ? jobListingResponse.Job.CustomData["Salaries[0].Filters[0].Max"] : null, FullDescription = jobListingResponse.Job.Description, Description = jobListingResponse.Job.ShortDescription, AdvertiserCompanyName = jobListingResponse.Job.CustomData.ContainsKey("CompanyName") ? jobListingResponse.Job.CustomData["CompanyName"] : null, ProfessionName = jobListingResponse.Job.CustomData.ContainsKey("Classifications[0].Filters[0].Value") ? jobListingResponse.Job.CustomData["Classifications[0].Filters[0].Value"] : null, LocationName = jobListingResponse.Job.CustomData.ContainsKey("CountryLocationArea[0].Filters[0].Value") ? jobListingResponse.Job.CustomData["CountryLocationArea[0].Filters[0].Value"] : null, AreaName = jobListingResponse.Job.CustomData.ContainsKey("CountryLocationArea[0].Filters[0].SubLevel[0].Value") ? jobListingResponse.Job.CustomData["CountryLocationArea[0].Filters[0].SubLevel[0].Value"] : null, JobName = jobListingResponse.Job.Title, DatePosted = string.Format("|{0}+{1}|", utcTime.ToString("yyyy-MM-ddThh:mm:ss"), offset.Hours.ToString("00") + ":" + offset.Minutes.ToString("00")), ExpiryDate = (jobListingResponse.Job.ExpiryDate.HasValue) ? string.Format("|{0}+{1}|", eutcTime.ToString("yyyy-MM-ddThh:mm:ss"), eoffset.Hours.ToString("00") + ":" + eoffset.Minutes.ToString("00")) : string.Empty, Address = jobListingResponse.Job.Address })); var fullTemplateName = this.templateNamePrefix + this.TemplateName; // If it is null make sure that pass empty string , because html attrubutes will not work properly. viewModel.JobDetails.Address = viewModel.JobDetails.Address == null ? "" : viewModel.JobDetails.Address; viewModel.JobDetails.AddressLatitude = viewModel.JobDetails.AddressLatitude == null ? "" : viewModel.JobDetails.AddressLatitude; viewModel.JobDetails.AddressLongtitude = viewModel.JobDetails.AddressLongtitude == null ? "" : viewModel.JobDetails.AddressLongtitude; #region Check job already applied ViewBag.IsJobApplied = false; JXTNext_MemberAppliedJobResponse response = _BLConnector.MemberAppliedJobsGet() as JXTNext_MemberAppliedJobResponse; if (response.Success) { foreach (var item in response.MemberAppliedJobs) { if (item.JobId == jobId.Value) { ViewBag.IsJobApplied = true; break; } } } #endregion var meta = new System.Web.UI.HtmlControls.HtmlMeta(); meta.Attributes.Add("property", "og:title"); meta.Content = jobListingResponse.Job.Title; // Get the current page handler in order to access the page header var pageHandler = this.HttpContext.CurrentHandler.GetPageHandler(); pageHandler.Header.Controls.Add(meta); return(View(fullTemplateName, viewModel)); } else { if (jobListingResponse.Job != null && jobListingResponse.Job.IsDeleted) { return(Content("This Job is no longer available!")); } else { return(Content("No job has been found")); } } } return(Content("No job has been selected")); }