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 CompanySearch(string companyName, Action<JobSearchMainInfo> success, Action<string> error)
        {
            JobSearchMainInfo jobSearchMainResults = new JobSearchMainInfo();

            string resource = string.Format("/jobSearch?DeveloperKey={0}", AppResources.CareerBuilderDeveloperKey);
            resource = String.Format("{0}&CompanyName={1}", resource, companyName);
            resource = String.Format("{0}&PerPage={1}", resource, 50);

            _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);
                }
            });
        }
        private void OnSortSearchResults(JobSearchEnum.SortingCriteria payload)
        {
            if (Criteria != null)
            {
                switch (payload)
                {
                    case JobSearchEnum.SortingCriteria.Date:
                        Criteria.OrderBy = "Date";
                        Criteria.OrderDirection = string.Empty;
                        break;
                    case JobSearchEnum.SortingCriteria.PayHigh:
                        Criteria.OrderBy = "Pay";
                        Criteria.OrderDirection = "DESC";
                        break;
                    case JobSearchEnum.SortingCriteria.PayLow:
                        Criteria.OrderBy = "Pay";
                        Criteria.OrderDirection = "ASC";
                        break;
                    case JobSearchEnum.SortingCriteria.Title:
                        Criteria.OrderBy = "Title";
                        Criteria.OrderDirection = "ASC";
                        break;
                    case JobSearchEnum.SortingCriteria.Company:
                        Criteria.OrderBy = "Company";
                        Criteria.OrderDirection = "ASC";
                        break;
                    case JobSearchEnum.SortingCriteria.Distance:
                        Criteria.OrderBy = "Distance";
                        Criteria.OrderDirection = string.Empty;
                        break;
                    case JobSearchEnum.SortingCriteria.Relevance:
                        Criteria.OrderBy = "Relevance";
                        Criteria.OrderDirection = string.Empty;
                        break;
                    default:
                        break;
                }

                //sort
                SearchMainInfo = new JobSearchMainInfo();
                IsLoadMore = false;
                Criteria.PageNumber = 1;
                if (IsFullSearch)
                {
                    PerformAdvancedSearch(Criteria);
                }
                else
                {
                    PerformQuickSearch(Criteria);
                }
            }
        }