예제 #1
0
        public JobModel GetJob(string jobkey)
        {
            WebClient webclient;
            string    url  = _apilink + "?publisher=" + _apikey + "&jobkeys=" + jobkey + "&v=2&format=json";
            string    json = string.Empty;

            using (webclient = new WebClient())
            {
                webclient.Encoding = System.Text.Encoding.UTF8;
                json = webclient.DownloadString(url);
            }
            IndeedResults jObj = JsonConvert.DeserializeObject <IndeedResults>(json);

            return(new JobModel()
            {
                JobTitle = jObj.results[0].JobTitle,
                Company = jObj.results[0].Company,
                Description = jObj.results[0].Description,
                Date = jObj.results[0].Date,
                Url = jObj.results[0].Url,
                Location = jObj.results[0].Location,
                Latitude = jObj.results[0].Latitude,
                Longitude = jObj.results[0].Longitude,
                Salary = jObj.results[0].Salary,
            });
        }
예제 #2
0
        /// <summary>
        /// Search jobs
        /// </summary>
        /// <returns></returns>
        public IndeedResults Search()
        {
            IndeedResults jObj = doSearch(_start);

            while (jObj.results.Count < int.Parse(jObj.totalresults) &&
                   jObj.results.Count < 1000)
            {
                _start += 25;
                jObj.results.AddRange(doSearch(_start).results);
            }

            return(jObj);
        }
예제 #3
0
        /// <summary>
        /// Job search: helper method
        /// </summary>
        /// <param name="start"></param>
        /// <returns></returns>
        private IndeedResults doSearch(int start)
        {
            WebClient webclient;

            _searchparams.Clear();
            BuildParams(start);
            string url  = Url.BuildURL(_searchparams, _apilink);
            string json = string.Empty;

            using (webclient = new WebClient())
            {
                webclient.Encoding = System.Text.Encoding.UTF8;
                json = webclient.DownloadString(url);
            }
            IndeedResults jObj = JsonConvert.DeserializeObject <IndeedResults>(json);

            return(jObj);
        }