public void QuickSearch(JobSearchCriteria criteria, Action<JobSearchMainInfo> success, Action<string> error)
        {
            JobSearchMainInfo jobSearchMainResults = new JobSearchMainInfo();

            string resource = string.Format("/jobSearch?DeveloperKey={0}", AppResources.CareerBuilderDeveloperKey);
            //Add Search Parameters
            if (criteria != null)
            {
                resource = String.Format("{0}&Keywords={1}", resource, criteria.Keywords);
                resource = String.Format("{0}&PageNumber={1}", resource, (criteria.PageNumber <= 0 ? "1" : criteria.PageNumber.ToString()));
                resource = String.Format("{0}&PerPage={1}", resource, 25);
                resource = String.Format("{0}&OrderBy={1}", resource, (String.IsNullOrWhiteSpace(criteria.OrderBy) ? "Date" : criteria.OrderBy));
                if (!String.IsNullOrWhiteSpace(criteria.OrderDirection))
                {
                    resource = String.Format("{0}&OrderDirection={1}", resource, criteria.OrderDirection);
                }                
            }

            _restRequest.Resource = resource;

            _restClient.ExecuteAsync<JobSearchResultDTO>(_restRequest, (args) =>
            {
                if (args.StatusCode == HttpStatusCode.OK)
                {
                    if (args.Data != null)
                    {
                        //Set paging values
                        jobSearchMainResults.TotalPages = args.Data.TotalPages;
                        jobSearchMainResults.TotalCount = args.Data.TotalCount;
                        jobSearchMainResults.FirstItemIndex = args.Data.FirstItemIndex;
                        jobSearchMainResults.LastItemIndex = args.Data.LastItemIndex;

                        if (args.Data.Results != null)
                        {
                            foreach (var result in args.Data.Results)
                            {
                                jobSearchMainResults.ResultInfo.Add(new JobSearchResultInfo(result));
                            }
                            success(jobSearchMainResults);
                        }
                        else
                        {
                            if (args.Data.Errors != null && args.Data.Errors.Count > 0)
                            {
                                error(String.Format("Quick Search Error - {0}", args.Data.Errors[0].Value));
                            }
                            else
                            {
                                error("Quick Search Error - args.Data.Results is null");
                            }
                        }
                    }
                    else
                    {
                        error("Quick Search Error - args.Data is null");
                    }
                }
                else
                {
                    error(args.ErrorMessage);
                }
            });
        }
        public void JobSearch(JobSearchCriteria criteria, Action<JobSearchMainInfo> success, Action<string> error)
        {
            JobSearchMainInfo jobSearchMainResults = new JobSearchMainInfo();

            string resource = string.Format("/jobSearch?DeveloperKey={0}", AppResources.CareerBuilderDeveloperKey);

            //Add Search Parameters
            if (criteria != null)
            {
                resource = String.Format("{0}&Keywords={1}", resource, criteria.Keywords);
                resource = String.Format("{0}&CompanyName={1}", resource, criteria.CompanyName);
                resource = String.Format("{0}&PageNumber={1}", resource, (criteria.PageNumber <= 0 ? "1" : criteria.PageNumber.ToString()));
                resource = String.Format("{0}&PerPage={1}", resource, 25);
                resource = String.Format("{0}&OrderBy={1}", resource, (String.IsNullOrWhiteSpace(criteria.OrderBy) ? "Date" : criteria.OrderBy));

                if (criteria.Latitude != 0 && criteria.Longitude != 0)
                {
                    resource = String.Format("{0}&Location={1}", resource, String.Format("{0}::{1}", criteria.Latitude, criteria.Longitude));
                }
                else
                {
                    if (!String.IsNullOrWhiteSpace(criteria.FriendlyLocation))
                    {
                        resource = String.Format("{0}&Location={1}", resource, criteria.FriendlyLocation);
                    }
                }

                if (criteria.Radius != null && criteria.Radius.Code != null)
                {
                    resource = String.Format("{0}&Radius={1}", resource, criteria.Radius.Code);
                }
                if (criteria.Category != null && criteria.Category.Code != null)
                {
                    if (!criteria.Category.Code.Equals("-1"))
                    {
                        resource = String.Format("{0}&Category={1}", resource, criteria.Category.Code);
                    }
                }
                if (criteria.EducationCode != null && criteria.EducationCode.Code != null)
                {
                    if (!criteria.EducationCode.Code.Equals("-1"))
                    {
                        resource = String.Format("{0}&EducationCode={1}", resource, criteria.EducationCode.Code);
                    }
                }
                if (criteria.SpecificEducation.HasValue)
                {
                    bool val = !criteria.SpecificEducation.Value;
                    resource = String.Format("{0}&SpecificEducation={1}", resource, val.ToString());
                }
                if (criteria.LastPosted != null && criteria.LastPosted.Code != null)
                {
                    resource = String.Format("{0}&PostedWithin={1}", resource, criteria.LastPosted.Code);
                }
                if (criteria.EmployeeType != null && criteria.EmployeeType.Code != null)
                {
                    if (!criteria.EmployeeType.Code.Equals("-1"))
                    {
                        resource = String.Format("{0}&EmpType={1}", resource, criteria.EmployeeType.Code);
                    }
                }
                if (criteria.PayLow != null && criteria.PayLow.Code != null)
                {
                    resource = String.Format("{0}&PayLow={1}", resource, criteria.PayLow.Code);
                }
                if (criteria.PayHigh != null && criteria.PayHigh.Code != null)
                {
                    resource = String.Format("{0}&PayHigh={1}", resource, criteria.PayHigh.Code);
                }
            }

            _restRequest.Resource = resource;

            _restClient.ExecuteAsync<JobSearchResultDTO>(_restRequest, (args) =>
            {
                if (args.StatusCode == HttpStatusCode.OK)
                {
                    if (args.Data != null)
                    {
                        //Set paging values
                        jobSearchMainResults.TotalPages = args.Data.TotalPages;
                        jobSearchMainResults.TotalCount = args.Data.TotalCount;
                        jobSearchMainResults.FirstItemIndex = args.Data.FirstItemIndex;
                        jobSearchMainResults.LastItemIndex = args.Data.LastItemIndex;

                        if (args.Data.Results != null)
                        {
                            foreach (var result in args.Data.Results)
                            {
                                jobSearchMainResults.ResultInfo.Add(new JobSearchResultInfo(result));
                            }
                            success(jobSearchMainResults);
                        }
                        else
                        {
                            if (args.Data.Errors != null && args.Data.Errors.Count > 0)
                            {
                                error(String.Format("Job Search Error - {0}", args.Data.Errors[0].Value));
                            }
                            else
                            {
                                error("Job Search Error - args.Data.Results is null");
                            }
                        }
                    }
                    else
                    {
                        error("Job Search Error - args.Data is null");
                    }
                }
                else
                {
                    error(args.ErrorMessage);
                }
            });
        }
        public void PreviewSearch(JobSearchCriteria criteria, Action<int> success, Action<string> error)
        {
            string resource = string.Format("/jobSearch?DeveloperKey={0}", AppResources.CareerBuilderDeveloperKey);

            //Add Search Parameters
            if (criteria != null)
            {
                resource = String.Format("{0}&Keywords={1}", resource, criteria.Keywords);
                //_restRequest.AddUrlSegment("CompanyName", criteria.CompanyName);
                //resource = String.Format("{0}&PageNumber={1}", resource, (criteria.PageNumber <= 0 ? "1" : criteria.PageNumber.ToString()));
                resource = String.Format("{0}&OrderBy={1}", resource, (String.IsNullOrWhiteSpace(criteria.OrderBy) ? "Date" : criteria.OrderBy));

                if (criteria.Latitude != 0 && criteria.Longitude != 0)
                {
                    resource = String.Format("{0}&Location={1}", resource, String.Format("{0}::{1}", criteria.Latitude, criteria.Longitude));
                }
                else
                {
                    if (!String.IsNullOrWhiteSpace(criteria.FriendlyLocation))
                    {
                        resource = String.Format("{0}&Location={1}", resource, criteria.FriendlyLocation);
                    }
                }

                if (criteria.Radius != null)
                {
                    resource = String.Format("{0}&Radius={1}", resource, criteria.Radius.Code);
                }
                if (criteria.Category != null)
                {
                    if (!criteria.Category.Code.Equals("-1"))
                    {
                        resource = String.Format("{0}&Category={1}", resource, criteria.Category.Code);
                    }
                }
                if (criteria.EducationCode != null)
                {
                    if (!criteria.EducationCode.Code.Equals("-1"))
                    {
                        resource = String.Format("{0}&EducationCode={1}", resource, criteria.EducationCode.Code);
                    }
                }
                if (criteria.SpecificEducation.HasValue)
                {
                    bool val = !criteria.SpecificEducation.Value;
                    resource = String.Format("{0}&SpecificEducation={1}", resource, val.ToString());
                }
                if (criteria.LastPosted != null)
                {
                    resource = String.Format("{0}&PostedWithin={1}", resource, criteria.LastPosted.Code);
                }
                if (criteria.EmployeeType != null)
                {
                    if (!criteria.EmployeeType.Code.Equals("-1"))
                    {
                        resource = String.Format("{0}&EmpType={1}", resource, criteria.EmployeeType.Code);
                    }
                }
                if (criteria.PayLow != null)
                {
                    resource = String.Format("{0}&PayLow={1}", resource, criteria.PayLow.Code);
                }
                if (criteria.PayHigh != null)
                {
                    resource = String.Format("{0}&PayHigh={1}", resource, criteria.PayHigh.Code);
                }
            }

            _restRequest.Resource = resource;

            _restClient.ExecuteAsync<JobSearchResultDTO>(_restRequest, (args) =>
            {
                if (args.StatusCode == HttpStatusCode.OK)
                {
                    if (args.Data != null)
                    {
                        if (args.Data.Results != null)
                        {
                            success(args.Data.TotalCount);
                        }
                        else
                        {
                            if (args.Data.Errors != null && args.Data.Errors.Count > 0)
                            {
                                error(String.Format("Job Search Error - {0}", args.Data.Errors[0].Value));
                            }
                            else
                            {
                                error("Job Search Error - args.Data.Results is null");
                            }
                        }
                    }
                    else
                    {
                        error("Job Search Error - args.Data is null");
                    }
                }
                else
                {
                    error(args.ErrorMessage);
                }
            });
        }
Ejemplo n.º 4
0
        private bool IsSearchInSavedSearches(JobSearchCriteria searchItem)
        {
            foreach (var search in SavedSearches)
            {
                //if so, raise message, if not, save alert
                if (searchItem.Keywords == search.Keywords
                    && searchItem.FriendlyLocation == search.FriendlyLocation)
                {
                    return true;
                }
            }

            return false;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Performs the quick search.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        private void PerformQuickSearch(JobSearchCriteria criteria)
        {
            if (!IsNetworkAvailable())
                return;

            IsBusy = true;
            int ranking = 1;
            cbSvc.QuickSearch(criteria,
                (response) =>
                {
                    if (response != null)
                    {
                        SearchMainInfo = response;
                        if (SearchMainInfo.ResultInfo != null)
                        {
                            DispatcherHelper.CheckBeginInvokeOnUI(() =>
                            {
                                if (!IsLoadMore)
                                {
                                    JobSearchResults.Clear();
                                }

                                if (IsLoadMore)
                                {
                                    ranking = JobSearchResults.Count + ranking;
                                }

                                foreach (var job in SearchMainInfo.ResultInfo)
                                {
                                    job.Ranking = ranking++;
                                    JobSearchResults.Add(job);
                                }

                                NotifyPropertyChanged("JobSearchResults");

                                if (JobSearchResults.Count > 0)
                                {
                                    LoadMapPins(JobSearchResults);
                                }

                                if (IsLoadMore)
                                {
                                    Messenger.Default.Send<bool>(true, "LoadMoreCompleteRequest");
                                }
                            });
                        }
                    }
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        IsBusy = false;
                    });
                },
                (error) =>
                {
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        IsBusy = false;
                        ShowErrorMessage();
                    });
                });
        }
Ejemplo n.º 6
0
 private void RemoveSavedSearch(JobSearchCriteria savedSearch)
 {
     if (IsSearchInSavedSearches(savedSearch))
     {
         if (SavedSearches.Remove(savedSearch))
         {
             persistentStore.Backup(IsolatedStorageKeys.SAVED_SEARCHES, SavedSearches);
         }
     }
     else
     {
         MessageBox.Show("This saved search no longer exists.  If this is incorrect, please try again or contact us.");
         return;
     }
     //MessageBox.Show("Your search(es) have been removed.");
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Performs the save search.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        private void PerformSaveSearch(JobSearchCriteria criteria)
        {
            //get watch list
            GetSavedSearches(null);

            if (SavedSearches.Count <= 0)
            {
                //insert immediately
                SavedSearches.Add(criteria);
                persistentStore.Backup(IsolatedStorageKeys.SAVED_SEARCHES, SavedSearches);
                MessageBox.Show("Your search has been saved.");
            }
            else
            {
                //make sure current alert doesn't already exists
                //if so, raise message, if not, save alert
                if (IsSearchInSavedSearches(criteria))
                {
                    MessageBox.Show("A similar job search already exists in your saved searches");
                    return;
                }

                SavedSearches.Add(criteria);
                persistentStore.Backup(IsolatedStorageKeys.SAVED_SEARCHES, SavedSearches);
                MessageBox.Show("Your search has been saved.");
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Performs the reset search criteria.
 /// </summary>
 /// <param name="criteria">The criteria.</param>
 private void PerformResetSearchCriteria()
 {
     Criteria = new JobSearchCriteria();
     ClearDropDowns();
     Criteria.SpecificEducation = true;
     ThreadPool.QueueUserWorkItem(new WaitCallback(LoadDropDowns));
     Messenger.Default.Send<bool>(true, "ResetSearchCompleteRequest");
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Performs advanced search.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        private void PerformAdvancedSearch(JobSearchCriteria criteria)
        {
            if (!IsNetworkAvailable())
                return;

            IsBusy = true;
            int ranking = 1;
            cbSvc.JobSearch(criteria,
                (response) =>
                {
                    if (response != null)
                    {
                        SearchMainInfo = response;
                        if (SearchMainInfo.ResultInfo != null)
                        {
                            DispatcherHelper.CheckBeginInvokeOnUI(() =>
                                {
                                    if (!IsLoadMore)
                                    {
                                        JobSearchResults.Clear();
                                    }

                                    if (IsLoadMore)
                                    {
                                        ranking = JobSearchResults.Count + ranking;
                                    }

                                    foreach (var job in SearchMainInfo.ResultInfo)
                                    {
                                        job.Ranking = ranking++;
                                        JobSearchResults.Add(job);
                                    }

                                    if (JobSearchResults.Count > 0)
                                    {
                                        LoadMapPins(JobSearchResults);
                                    }

                                    if (IsLoadMore)
                                    {
                                        Messenger.Default.Send<bool>(true, "LoadMoreCompleteRequest");
                                    }

                                    SendNavigationRequestMessage(new Uri(String.Format("/SearchResultsPage/{0}/{1}", string.Empty, false.ToString()), UriKind.Relative), "AdvancedSearchComplete");
                                });
                        }
                    }
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        IsBusy = false;
                    });
                },
                (error) =>
                {
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        IsBusy = false;
                        ShowErrorMessage();
                    });
                });
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Performs the preview search.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        private void PerformPreviewSearch(JobSearchCriteria criteria)
        {
            if (!IsNetworkAvailable())
                return;

            IsBusy = true;
            cbSvc.PreviewSearch(criteria,
                (response) =>
                {
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        NumOfPreviewResults = response;
                        Messenger.Default.Send<int>(NumOfPreviewResults, "PreviewSearchCompleteRequest");
                    });
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        IsBusy = false;
                    });
                },
                (error) =>
                {
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        IsBusy = false;
                        ShowErrorMessage();
                    });
                });
        }