예제 #1
0
        public void DeserializeJobs()
        {
            try
            {
                using (Stream stream = File.Open("Jobsdata.bin", FileMode.Open))
                {
                    PostedJobsLog   log      = PostedJobsLog.Create;
                    BinaryFormatter bin      = new BinaryFormatter();
                    var             profiles = (List <PostedJobs>)bin.Deserialize(stream);

                    foreach (var x in profiles)
                    {
                        if (log.Contains(x.Name) == false)
                        {
                            if (x.Name.Length > 3)
                            {
                                log.JobsList.Add(x);
                            }
                        }
                    }
                }
            }
            catch (IOException)
            {
            }
        }
예제 #2
0
        private string MatchTR(string p, DateTime date1, DateTime date2, bool radiocheck)
        {
            string        pattern      = "<td (?<data>.*?)</td>";
            Regex         r            = new Regex(pattern, RegexOptions.Singleline);
            PostedJobsLog log          = PostedJobsLog.Create;
            string        EncryptedJID = MatchEncryptedJID(p);
            string        text         = null;
            int           jobcount     = 0;

            foreach (Match i in r.Matches(p))
            {
                jobcount++;
                PostedJobs job         = new PostedJobs();
                string     JobNameTemp = MatchName(i.Groups["data"].Value).Replace("/", "-").Trim();
                job.Date = MatchJobDate(p);
                if (radiocheck == true && String.IsNullOrEmpty(job.Date) == false)
                {
                    DateTime AppliedDate = new DateTime();
                    AppliedDate = IsAppliedEarlier(job.Date);

                    if (DateTime.Compare(AppliedDate, date1) < 0)
                    {
                        continue;
                    }
                    if (DateTime.Compare(AppliedDate, date2) > 0)
                    {
                        continue;
                    }
                }
                if (JobNameTemp.Length > 3)
                {
                    job.Name = JobNameTemp.Replace("&lrm;", "").Trim();
                    if (log.Contains(job.Name.Trim()) == false)
                    {
                        OnInformationDownload(new EventArguments()
                        {
                            Name = "Counting Jobs" + jobcount + " ", Details = job.Name, Date = DateTime.Now
                        });
                        job.Link            = "http://hiring.rozee.pk/" + MatchLink(i.Groups["data"].Value);
                        job.TotalApplicants = MatchParticipants(p);
                        job.Status          = MatchActivation(p);
                        job.EncryptedJobID  = EncryptedJID + "=&";
                        log.JobsList.Add(job);
                        text = null;
                    }
                }
            }
            return(text);
        }
예제 #3
0
        public void CreateDirectories()
        {
            PostedJobsLog log = PostedJobsLog.Create;

            foreach (var x in log.JobsList)
            {
                string Name     = x.Name.Replace("&Irm", "");
                bool   isExists = System.IO.Directory.Exists(System.IO.Path.Combine(InitialPath + @"\CV\" + x.Name + @"\"));

                if (!isExists)
                {
                    System.IO.Directory.CreateDirectory(System.IO.Path.Combine(InitialPath + @"\CV\" + x.Name + @"\"));
                }
            }
        }
예제 #4
0
 public void SerializeJobs()
 {
     try
     {
         using (Stream stream = File.Open("Jobsdata.bin", FileMode.Create))
         {
             PostedJobsLog   log = PostedJobsLog.Create;
             BinaryFormatter bin = new BinaryFormatter();
             bin.Serialize(stream, log.JobsList);
         }
     }
     catch (IOException)
     {
     }
 }
예제 #5
0
        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)
                    {
                    }
                }
            }
        }
예제 #6
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                if (radioButtonSpecificDate.Checked == true)
                {
                    Date1 = dateTimePicker1.Value.Date;
                    Date2 = dateTimePicker2.Value.Date;
                    if (DateTime.Compare(Date1, Date2) >= 0)
                    {
                        MessageBox.Show("Ambigious Dates Error\nDetails:\n\nEither selected Date is same or ambigious difference");
                        e.Cancel = true;
                        return;
                    }
                }
            }
            catch (Exception)
            {
                e.Cancel = true;
                return;
            }

            RelativePath = textBoxFolderAdress.Text;
            ProfileLog    profilelog = ProfileLog.Create;
            CSVhandler    handler    = new CSVhandler();
            PostedJobsLog jobs       = PostedJobsLog.Create;


            backgroundWorker1.ReportProgress(0);
            if (backgroundWorker1.CancellationPending == true)
            {
                e.Cancel = true;
                return;
            }
            string x = null;

            try
            {
                string password   = null;
                string loginEmail = null;
                if (comboBoxEmails.InvokeRequired)
                {
                    comboBoxEmails.Invoke(new Action(() => loginEmail = comboBoxEmails.Text));
//                    comboBoxEmails.Invoke(new ControlStringConsumer(SetText), new object[] {comboBoxEmails, "" });
                }
                else
                {
                    loginEmail = comboBoxEmails.Text;
                }
                password = profilelog.FindPasswordofThisEmail(loginEmail);

                x = w.Login(loginEmail, password);
            }
            catch (System.Net.WebException)
            {
                notifyIcon1.BalloonTipIcon  = ToolTipIcon.Error;
                notifyIcon1.BalloonTipTitle = "Connection Error";
                notifyIcon1.BalloonTipText  = "Please connect to internet in order to download CV's\n ";
                notifyIcon1.ShowBalloonTip(1000);
                e.Cancel = true;
                return;
            }

            if (String.IsNullOrEmpty(x) == false)
            {
                MessageBox.Show(x);
                e.Cancel = true;
                return;
            }
            if (backgroundWorker1.CancellationPending == true)
            {
                e.Cancel = true;
                return;
            }
            backgroundWorker1.ReportProgress(1);
            w.DownloadAllPostedJobs(Date1, Date2, radioButtonSpecificDate.Checked);
            if (backgroundWorker1.CancellationPending == true)
            {
                e.Cancel = true;
                return;
            }
            backgroundWorker1.ReportProgress(2);
            w.CreateDirectories();
            if (backgroundWorker1.CancellationPending == true)
            {
                e.Cancel = true;
                return;
            }
            backgroundWorker1.ReportProgress(3);
            if (backgroundWorker1.CancellationPending == true)
            {
                e.Cancel = true;
                return;
            }
            w.OpenAllLinks(Date1, Date2, radioButtonSpecificDate.Checked);
            backgroundWorker1.ReportProgress(12);
            if (backgroundWorker1.CancellationPending == true)
            {
                e.Cancel = true;
                return;
            }
            try
            {
                handler.WriteTheApplicantLists(System.IO.Path.Combine(RelativePath));
            }
            catch (Exception eX)
            {
                MessageBox.Show(eX.Message);
            }
            backgroundWorker1.ReportProgress(18);
            if (backgroundWorker1.CancellationPending == true)
            {
                e.Cancel = true;
                return;
            }

            x = handler.WriteFolderApplicantLists(RelativePath);
            if (String.IsNullOrEmpty(x) == false)
            {
                MessageBox.Show(x);
            }


            if (radioButtonRecent.Checked == false && radioButtonSpecificDate.Checked == true)
            {
                w.DownloadCVS(textBoxFolderAdress.Text);
            }
            else if (radioButtonRecent.Checked == true && radioButtonSpecificDate.Checked == false)
            {
                w.DownloadCVS(textBoxFolderAdress.Text);
            }


            if (backgroundWorker1.CancellationPending == true)
            {
                e.Cancel = true;
                return;
            }
            backgroundWorker1.ReportProgress(100);
        }
예제 #7
0
        public string WriteFolderApplicantLists(string InitialPath)
        {
            string ErrorText = null;

            /*  InitialPath=System.IO.Path.Combine(InitialPath+ @"CV");
             * if (Directory.Exists(InitialPath) == false)
             * {
             *    Directory.CreateDirectory(InitialPath);
             * }
             *
             * InitialPath = System.IO.Path.Combine(InitialPath + @"/ApplicantsReport.csv");
             *
             * try
             * {
             *    if (File.Exists(InitialPath))
             *    {
             *        File.Delete(InitialPath);
             *    }
             *
             * }
             * catch (IOException)
             * {
             *    return "Path is ambigious or Secured";
             * }
             * var ThisFile = File.Create(InitialPath);
             * ThisFile.Close();
             */

            /*
             *
             * Writing CSV file
             *
             */

            PostedJobsLog postedJoblogObj = PostedJobsLog.Create;


            foreach (PostedJobs x in postedJoblogObj.JobsList)
            {
                if (Directory.Exists(InitialPath + @"\CV\" + x.Name + @"\") == false)
                {
                    Directory.CreateDirectory(InitialPath + @"\CV\" + x.Name + @"\");
                }
                string headerLine = "Name,Nationality,Experience,Carrier Level,Expected Salary,Current Salary,Degree Level,Education,Industry,Functional Area,Professional Summary,imageLink,CV folder,CV number,Apply Date,marital Status,tags" + ",\r";
                File.AppendAllText(InitialPath + @"\CV\" + x.Name + @"\" + x.Name + @".csv", headerLine);
                headerLine = null;
                ApplicantLog applog = ApplicantLog.Create;
                foreach (Applicant i in applog.applicantsList)
                {
                    if (i.FolderName.Equals(x.Name) == true)
                    {
                        StringBuilder sb          = new StringBuilder();
                        StringBuilder Tagsbuilder = new StringBuilder();

                        sb.Clear();
                        Tagsbuilder.Clear();

                        /*  foreach (string j in i.tags)
                         * {
                         *    Tagsbuilder.Clear();
                         *    j.Replace(",", "");
                         *    sb.Append(j+"-");
                         * }*/
                        sb.AppendLine(i.Name + "," + i.Nationality + "," + i.Experience + "," + i.CarrierLevel + "," + i.ExpectedSalary + "," + i.CurrentSalary + "," + i.DegreeLevel + "," + i.Education + "," + i.Industry + "," + i.FunctionalArea + "," + i.ProfessionalSummary + "," + i.PictureLink + "," + i.FolderName + "," + i.CVNumber + "," + i.ApplyDate + "," + i.MaritalStatus + "," + Tagsbuilder + ",");
                        File.AppendAllText(InitialPath + @"\CV\" + x.Name + @"\" + x.Name + ".csv", sb.ToString());
                    }
                }
            }
            return(ErrorText);
        }