public void DeserializeApplicants() { try { using (Stream stream = File.Open("Applicantsdata.bin", FileMode.Open)) { ApplicantLog log = ApplicantLog.Create; BinaryFormatter bin = new BinaryFormatter(); var profiles = (List <Applicant>)bin.Deserialize(stream); foreach (var x in profiles) { if (String.IsNullOrEmpty(x.Name) == false && log.Contains(x.CVNumber) == false && x.Name.Length > 3) { log.applicantsList.Add(x); } } } } catch (IOException) { } }
public void OpenAllLinks(DateTime date1, DateTime date2, bool radiocheck) { PostedJobsLog log = PostedJobsLog.Create; foreach (PostedJobs i in log.JobsList) { StringBuilder ApplicantsString = null; OnInformationDownload(new EventArguments() { Name = i.Name, Details = "Starting Fetching Information .... ", Date = DateTime.Now }); try { ApplicantsString = new StringBuilder(client.DownloadString(i.Link)); } catch (Exception) { } int totalApplicants = 0; if (i.TotalApplicants.Equals("") || String.IsNullOrEmpty(i.TotalApplicants)) { i.TotalApplicants = ReadtotalApplicantsAgain(ApplicantsString.ToString()); int.TryParse(i.TotalApplicants, out totalApplicants); } else { int.TryParse(i.TotalApplicants, out totalApplicants); } /* * Foreach page of this job * */ StringBuilder ReservedLink = new StringBuilder(); ReservedLink.Append("http://hiring.rozee.pk/job-applicantsCen.php?jid=" + i.EncryptedJobID + "ordBy=byDate&srtDir=desc&offset="); int totalPages = (int)Math.Ceiling((decimal)totalApplicants / 16); int pageCount = 0; while (pageCount != totalPages) { ////////////*******************/////////////////// string pattern = @"<!--Single\sapplicant\sBox\sStart\s-->(?<data>.*?)<!--Single\sapplicant\sBox\sEnd\s-->"; Regex r = new Regex(pattern, RegexOptions.Singleline); string Tempname = i.Name; ApplicantLog alog = ApplicantLog.Create; foreach (Match j in r.Matches(ApplicantsString.ToString())) { try { //SensitiVE Checking Applicant applicant = new Applicant(); if (radiocheck == true && String.IsNullOrEmpty(applicant.ApplyDate)) { DateTime AppliedDate = IsAppliedEarlier(applicant.ApplyDate); if (DateTime.Compare(AppliedDate, date1) < 0) { continue; } if (DateTime.Compare(AppliedDate, date2) > 0) { continue; } } applicant.CVNumber = FindCVNumber(j.Groups["data"].Value); // applicant.CVLink = "http://hiring.rozee.pk/"+FindCVLink( j.Groups["data"].Value); --Old Style applicant.CVLink = FindCVLink(j.Groups["data"].Value); OnInformationDownload(new EventArguments() { Name = applicant.FolderName, Details = " Fetching information of" + i.Name + " at page" + (pageCount + 1) + "/" + (totalPages + 1), Date = DateTime.Now }); applicant.ApplyDate = FindApplyDate(j.Groups["data"].Value); if (alog.Contains(applicant.CVNumber) == true) { continue; } applicant.FolderName = i.Name; applicant.Name = FindName(j.Groups["data"].Value); // applicant.tags = FindAlltags(j.Groups["data"].Value); --NOT WORKING // applicant.PictureLink = FindPictureLink(j.Groups["data"].Value); --NOT WORKING // applicant.ProfessionalSummary= --NotImplemented // applicant.Nationality = FindNationality(j.Groups["data"].Value); --NOT WORKING applicant.MaritalStatus = FindMaritalStatus(j.Groups["data"].Value); applicant.Experience = FindExperience(j.Groups["data"].Value); applicant.CarrierLevel = FindCarrierLevel(j.Groups["data"].Value); applicant.ExpectedSalary = FindExpectedSalary(j.Groups["data"].Value); applicant.CurrentSalary = FindCurrentSalary(j.Groups["data"].Value); applicant.DegreeLevel = FindDegreeLevel(j.Groups["data"].Value); StringBuilder builder = new StringBuilder(FindEducation(j.Groups["data"].Value)).Replace("<b>", ""); builder = builder.Replace("<\b>", ""); builder = builder.Replace("@Irm;", ""); builder.Clear(); applicant.Education = builder.ToString(); applicant.Industry = FindIndustry(j.Groups["data"].Value); applicant.FunctionalArea = FindFunctionalArea(j.Groups["data"].Value); alog.applicantsList.Add(applicant); } catch (Exception) { } } pageCount++; ApplicantsString.Clear(); StringBuilder newLink = new StringBuilder(""); newLink.Append(ReservedLink.ToString() + pageCount); try { ApplicantsString.Append(client.DownloadString(newLink.ToString())); } catch (WebException) { } } } }