Exemple #1
0
 public void SerializeApplicants()
 {
     try
     {
         using (Stream stream = File.Open("Applicantsdata.bin", FileMode.Create))
         {
             ApplicantLog    log = ApplicantLog.Create;
             BinaryFormatter bin = new BinaryFormatter();
             bin.Serialize(stream, log.applicantsList);
         }
     }
     catch (IOException)
     {
     }
 }
        public void DownloadCVS(string path)
        {
            path = path + @"\CV\\";
            ApplicantLog log = ApplicantLog.Create;

            foreach (Applicant i in log.applicantsList)
            {
                try
                {
                    string FileType1 = System.IO.Path.Combine(path + @"\" + i.FolderName + @"\" + i.CVNumber + ".pdf");
                    string FileType2 = System.IO.Path.Combine(path + @"\" + i.FolderName + @"\" + i.CVNumber + ".doc");
                    string FileType3 = System.IO.Path.Combine(path + @"\" + i.FolderName + @"\" + i.CVNumber + ".docx");



                    if (System.IO.File.Exists(FileType1) || System.IO.File.Exists(FileType2) || System.IO.File.Exists(FileType3))
                    {
                        continue;
                    }

                    OnInformationDownload(new EventArguments()
                    {
                        Name = i.CVNumber, Date = DateTime.Now, Details = "Downloading CV of " + i.Name
                    });
                    client.DownloadFile(i.CVLink, System.IO.Path.Combine(path + i.FolderName + @"\" + i.CVNumber));
                    string Extens = client.ResponseHeaders["Content-Disposition"].Replace("attachment; filename=\"ROZEE-CV-", "").Replace("\"", "");
                    i.OnlineFileName = System.IO.Path.Combine(path + i.FolderName + @"\" + Extens);
                    if (i.OnlineFileName.Contains(".pdf"))
                    {
                        System.IO.File.Move(System.IO.Path.Combine(path + i.FolderName + @"\" + i.CVNumber), System.IO.Path.Combine(path + i.FolderName + @"\" + i.CVNumber + ".pdf"));
                    }
                    else if (i.OnlineFileName.Contains(".docx"))
                    {
                        System.IO.File.Move(System.IO.Path.Combine(path + i.FolderName + @"\" + i.CVNumber), System.IO.Path.Combine(path + i.FolderName + @"\" + i.CVNumber + ".docx"));
                    }
                    else if (i.OnlineFileName.Contains(".doc"))
                    {
                        System.IO.File.Move(System.IO.Path.Combine(path + i.FolderName + @"\" + i.CVNumber), System.IO.Path.Combine(path + i.FolderName + @"\" + i.CVNumber + ".doc"));
                    }
                }
                catch (Exception)
                {
                    //Ignoring To get Performance
                }
            }
        }
Exemple #3
0
        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)
                    {
                    }
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// ////////////////////////////////////////////
        /// </summary>
        /// <param name="Path"></param>
        /// <returns></returns>

        public string WriteTheApplicantLists(string Path)
        {
            Path = System.IO.Path.Combine(Path + @"\\CV");
            if (Directory.Exists(Path) == false)
            {
                Directory.CreateDirectory(Path);
            }

            Path = System.IO.Path.Combine(Path + @"/ApplicantsReport.csv");

            try
            {
                if (File.Exists(Path))
                {
                    File.Delete(Path);
                }
            }
            catch (IOException)
            {
                return("Path is ambigious or Secured");
            }
            var ThisFile = File.Create(Path);

            ThisFile.Close();

            /*
             *
             * Writing CSV file
             *
             */

            StringBuilder sb          = new StringBuilder();
            StringBuilder Tagsbuilder = new StringBuilder();
            string        headerLine  = "Name,Experience,Carrier Level,Expected Salary,Current Salary,Degree Level,Education,Industry,Functional Area,CV folder,CV number,Apply Date,marital Status,\r";

            File.AppendAllText(Path, headerLine);
            ApplicantLog log = ApplicantLog.Create;

            try
            {
                foreach (Applicant i in log.applicantsList)
                {
                    sb.Clear();
                    Tagsbuilder.Clear();

                    /*  foreach (string j in i.tags)
                     * {
                     *    Tagsbuilder.Clear();
                     *    j.Replace(",", "");
                     *    sb.Append(j+"-");
                     * }*/
                    sb.AppendLine(i.Name + "," + i.Experience + "," + i.CarrierLevel + "," + i.ExpectedSalary + "," + i.CurrentSalary + "," + i.DegreeLevel + "," + i.Education + "," + i.Industry + "," + i.FunctionalArea + "," + i.FolderName + "," + i.CVNumber + "," + i.ApplyDate + "," + i.MaritalStatus + ",");
                    File.AppendAllText(Path, sb.ToString());
                }
            }
            catch (IOException e)
            {
                return(e.Message);
            }
            return(null);
        }
Exemple #6
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);
        }