public void GetJobDetails(string jobDID, Action<JobDetail> success, Action<string> error)
        {
            JobDetail job = new JobDetail();

            _restRequest.Resource = string.Format("/job?DeveloperKey={0}&DID={1}", AppResources.CareerBuilderDeveloperKey, jobDID);

            //Add Search Parameters
            if (!string.IsNullOrWhiteSpace(jobDID))
            {
                //_restRequest.AddUrlSegment("DID", jobDID);
            }
            _restClient.ExecuteAsync<JobDetailDTO>(_restRequest, (args) =>
            {
                if (args.StatusCode == HttpStatusCode.OK)
                {
                    /*
                    job = ParseJobDetails(args.Content);
                    if (job != null)
                    {
                        success(job);
                    }
                    else
                    {
                        error("Job Details Error - job is null");
                    }
                     * */

                    if (args.Data != null)
                    {
                        if (args.Data.ResponseJob != null)
                        {
                            job = new JobDetail(args.Data.ResponseJob);
                            success(job);
                        }
                        else if (!String.IsNullOrWhiteSpace(args.Content))
                        {
                            job = ParseJobDetails(args.Content);
                            success(job);
                        }
                        else
                        {
                            if (args.Data.Errors != null && args.Data.Errors.Count > 0)
                            {
                                error(String.Format("Job Details Error - {0}", args.Data.Errors[0].Value));
                            }
                            else
                            {
                                error("Job Details Error - args.Data.Results is null");
                            }
                        }
                    }
                    else
                    {
                        error("Job Details Error - args.Data is null");
                    }
                }
                else
                {
                    error(args.ErrorMessage);
                }
            });
        }
        private JobDetail ParseJobDetails(string responseContent)
        {
            XElement jobDetails = XElement.Parse(responseContent);
            JobDetail retVal = new JobDetail();

            var jobDetailItems = from jd in jobDetails.Descendants("Job")
                                 select new JobDetail
                                 {
                                     DID = jd.Element("DID").Value,
                                     DisplayJobID = jd.Element("DisplayJobID").Value,
                                     JobTitle = jd.Element("JobTitle").Value,
                                     JobDescription = Utilities.StripHTML(HttpUtility.HtmlDecode(jd.Element("JobDescription").Value)).Trim(),
                                     JobRequirements = (String.IsNullOrWhiteSpace(HttpUtility.HtmlDecode(jd.Element("JobRequirements").Value)) ? "N/A" : Utilities.StripHTML(HttpUtility.HtmlDecode(jd.Element("JobRequirements").Value)).Trim()),
                                     CompanyDID = jd.Element("CompanyDID").Value,
                                     Company = jd.Element("Company").Value,
                                     CompanyDetailsURL = jd.Element("CompanyDetailsURL").Value,
                                     CompanyImageURL = jd.Element("CompanyImageURL").Value,
                                     ContactInfoName = jd.Element("ContactInfoName").Value,
                                     ContactInfoEmailURL = jd.Element("ContactInfoEmailURL").Value,
                                     ContactInfoPhone = jd.Element("ContactInfoPhone").Value,
                                     LocationStreet1 = jd.Element("LocationStreet1").Value,
                                     LocationStreet2 = jd.Element("LocationStreet2").Value,
                                     LocationCity = jd.Element("LocationCity").Value,
                                     LocationMetroCity = jd.Element("LocationMetroCity").Value,
                                     LocationState = jd.Element("LocationState").Value,
                                     LocationPostalCode = jd.Element("LocationPostalCode").Value,
                                     LocationCountry = jd.Element("LocationCountry").Value,
                                     LocationFormatted = jd.Element("LocationFormatted").Value,
                                     LocationLatitude = Convert.ToDouble(jd.Element("LocationLatitude").Value),
                                     LocationLongitude = Convert.ToDouble(jd.Element("LocationLongitude").Value),
                                     PayPer = jd.Element("PayPer").Value,
                                     PayHighLowFormatted = jd.Element("PayHighLowFormatted").Value,
                                     EmploymentType = jd.Element("EmploymentType").Value,
                                     Division = jd.Element("Division").Value,
                                     Categories = jd.Element("Categories").Value,
                                     ApplyURL = jd.Element("ApplyURL").Value,
                                     TravelRequired = jd.Element("TravelRequired").Value,
                                     ExperienceRequired = jd.Element("ExperienceRequired").Value,
                                     DegreeRequired = jd.Element("DegreeRequired").Value,
                                     RelocationCovered = Convert.ToBoolean(jd.Element("RelocationCovered").Value),
                                     ManagesOthers = Convert.ToBoolean(jd.Element("ManagesOthers").Value)
                                 };

            retVal = jobDetailItems.FirstOrDefault();

            return retVal;
        }
예제 #3
0
 private void RemoveJob(JobDetail jobItem)
 {
     if (IsJobInSavedJobs(jobItem))
     {
         if (SavedJobs.Remove(jobItem))
         {
             persistentStore.Backup(IsolatedStorageKeys.JOBS_DATA, SavedJobs);
             MessageBox.Show("This job has been removed from your favorites.");
         }
     }
     else
     {
         MessageBox.Show("This job no longer exists as a favorite.  If this is incorrect, please try again or contact us.");
         return;
     }
     Messenger.Default.Send<bool>(true, "SaveDeleteJobCompleteRequest");
 }
예제 #4
0
        internal bool IsJobInSavedJobs(JobDetail jobItem)
        {
            foreach (var job in SavedJobs)
            {
                //if so, raise message, if not, save job
                if (jobItem.DID == job.DID)
                {
                    return true;
                }
            }

            return false;
        }
예제 #5
0
        /// <summary>
        /// Performs the save job.
        /// </summary>
        /// <param name="job">The job.</param>
        private void PerformSaveJob(JobDetail job)
        {
            //get watch list
            //GetSavedJobs(null);

            if (SavedJobs.Count <= 0)
            {
                //insert immediately
                SavedJobs.Add(job);
                persistentStore.Backup(IsolatedStorageKeys.JOBS_DATA, SavedJobs);
                MessageBox.Show("This job has been added to your favorites.");
            }
            else
            {
                //make sure current job doesn't already exists
                //if so, raise message, if not, save job
                if (IsJobInSavedJobs(job))
                {
                    MessageBox.Show("This job already exists as a favorite.");
                    return;
                }

                SavedJobs.Add(job);
                persistentStore.Backup(IsolatedStorageKeys.JOBS_DATA, SavedJobs);
                MessageBox.Show("This job has been added to your favorites.");
            }
            Messenger.Default.Send<bool>(true, "SaveDeleteJobCompleteRequest");
        }
예제 #6
0
        /// <summary>
        /// Emails the job.
        /// </summary>
        /// <param name="jobInfo">The job info.</param>
        private void EmailJob(JobDetail jobInfo)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("I thought you would be interested in this job:");
            sb.AppendLine();
            sb.AppendLine("JOB INFORMATION");
            sb.AppendLine(String.Format("Job Title: {0}", jobInfo.JobTitle));
            sb.AppendLine(String.Format("Company: {0}", jobInfo.Company));
            sb.AppendLine(String.Format("Location: {0}", jobInfo.LocationFormatted));
            sb.AppendLine(String.Format("Employee Type: {0}", jobInfo.EmploymentType));
            sb.AppendLine(String.Format("Req'd Education: {0}", jobInfo.DegreeRequired));
            sb.AppendLine(String.Format("Req'd Experience: {0}", jobInfo.ExperienceRequired));
            sb.AppendLine(String.Format("Pay: {0}", jobInfo.PayHighLowFormatted));
            sb.AppendLine();
            sb.AppendLine(String.Format("Apply Now: {0}", jobInfo.ApplyURL));

            EmailComposeTask emailTask = new EmailComposeTask
            {
                Subject = String.Format("{0} - {1}", jobInfo.JobTitle, jobInfo.LocationFormatted),
                Body = sb.ToString()
            };

            emailTask.Show();
        }
예제 #7
0
 private void RemoveSavedJob(JobDetail jobItem)
 {
     if (IsJobInSavedJobs(jobItem))
     {
         if (SavedJobs.Remove(jobItem))
         {
             persistentStore.Backup(IsolatedStorageKeys.JOBS_DATA, SavedJobs);
         }
     }
     else
     {
         MessageBox.Show("This job no longer exists as a favorite.  If this is incorrect, please try again or contact us.");
         return;
     }
     //MessageBox.Show("Your job(s) have been removed from your favorites.");
 }