public bool CheckJobAvailability(JobModel company, ref string companyHTMLContent) { String getCompanyURL = "http://id.jobsdb.com/ID/ID/Search/FindJobs?KeyOpt=COMPLEX&JSRV=1&RLRSF=1&JobCat=131&SearchFields=Positions,Companies&recentSelected=94&Key="; String formatCompanyURL = String.Format("{0}{1}", getCompanyURL, company.JobName); companyHTMLContent = webClient.DownloadString(formatCompanyURL); Match matchNoResult = Regex.Match(companyHTMLContent, @"<p class=""no-result-note"">\s+(.+)\s+<"); return matchNoResult.Success; }
public List<JobModel> GetJobs(string companyHTMLContent) { List<JobModel> resultGetJobsFromJobsdb = new List<JobModel>(); MatchCollection jobMatchCollection = Regex.Matches(companyHTMLContent, @"posLink"" href=""(.+?)"" id="".+?"">(.+?)<"); foreach (Match job in jobMatchCollection) { companyHTMLContent = webClient.DownloadString(job.Groups[1].Value); Match getDate = Regex.Match(companyHTMLContent, @"itemprop=.datePosted.+?--(\d{8})"); string tJobDate = getDate.Groups[1].Value; if (getDate.Success) { if (tJobDate.Length > 0) tJobDate = string.Format("{0}-{1}-{2} 00:00:00", tJobDate.Substring(0, 4), tJobDate.Substring(4, 2), tJobDate.Substring(6, 2)); else tJobDate = "2000-12-12 12:12:12"; if (tJobDate.Length != 19) tJobDate = "2000-12-12 12:12:12"; } else tJobDate = "2000-12-12 12:12:12"; DateTime jobDate = DateTime.Parse(tJobDate); JobModel jobModel = new JobModel() { JobLink = job.Groups[1].Value, JobName = job.Groups[2].Value, JobPublished = jobDate }; resultGetJobsFromJobsdb.Add(jobModel); } return resultGetJobsFromJobsdb; }
private void jobsDBPremium_ScanProgress(JobModel data, String state) { switch (state) { case "CheckJobAvailability": backgroundWorker.ReportProgress(0, new object[] { "status", "Scanning " + data.JobName }); break; case "JobAvailable": backgroundWorker.ReportProgress(0, new object[] { "listbox", new string[] { data.JobName, data.JobText, data.JobLink } }); break; } }
private void jobsDBPremium_ScanProgress(JobModel data, string state) { //main.SetListText(data.JobName, data.JobText); }
protected virtual void OnScanProgress(JobModel data, String state) { if (ScanProgress != null) ScanProgress(data, state); }
public int SaveJob(JobModel job) { job.JobType = "JobsDBPremiumKhususIT"; job.JobFavourite = 0; job.JobPublished = DateTime.Now; job.EntryDate = DateTime.Now; job.UpdateDate = DateTime.Now; job.Active = 1; return 1; }