コード例 #1
0
ファイル: JobsExtension.cs プロジェクト: bfxavier/JobsCrawler
 public void Adicionar(string Name, string Email)
 {
     using (grouponjobsdevEntities context = new grouponjobsdevEntities())
     {
         Recruiter rec = new Recruiter();
         rec.Name = Name;
         rec.Email = Email;
         context.Recruiters.AddObject(rec);
         context.SaveChanges();
     }
 }
コード例 #2
0
ファイル: JobsExtension.cs プロジェクト: bfxavier/JobsCrawler
 public void Adicionar(int CandidateId, string nota)
 {
     using (grouponjobsdevEntities context = new grouponjobsdevEntities())
     {
         Candidate_Note note = new Candidate_Note();
         note.CandidateId = CandidateId;
         note.Nota = nota;
         context.Candidate_Note.AddObject(note);
         context.SaveChanges();
     }
 }
コード例 #3
0
ファイル: JobsExtension.cs プロジェクト: bfxavier/JobsCrawler
 public void Adicionar(string CandidateName, string CampoErrado, string ValorErrado, string ex)
 {
     using (grouponjobsdevEntities context = new grouponjobsdevEntities())
     {
         Candidate_Log log = new Candidate_Log();
         log.CandidateName = CandidateName;
         log.CampoErrado = CampoErrado;
         log.ValorErrado = ValorErrado;
         log.Exception = ex;
         context.Candidate_Log.AddObject(log);
         context.SaveChanges();
     }
 }
コード例 #4
0
ファイル: JobsExtension.cs プロジェクト: bfxavier/JobsCrawler
 public void Adicionar(string FirstName, string LastName, int RatingId, int DispositionId, int RequisitionId, string Resume, string WorkFlow, int CityId)
 {
     using (grouponjobsdevEntities context = new grouponjobsdevEntities())
     {
         Candidate candidate = new Candidate();
         candidate.FirstName = FirstName;
         candidate.LastName = LastName;
         candidate.RatingId = RatingId;
         candidate.DispositionId = DispositionId;
         candidate.RequisitionId = RequisitionId;
         candidate.Resume = Resume;
         candidate.WorkFlow = WorkFlow;
         candidate.CityId = CityId;
         context.Candidates.AddObject(candidate);
         context.SaveChanges();
     }
 }
コード例 #5
0
ファイル: Requisitions.cs プロジェクト: bfxavier/JobsCrawler
        private void navigate(int i)
        {
            if (!browserJobVite.IsBusy)
            {
                if (i > 0)
                {
                    string CategoryDecoded = "";
                    string CityDecoded = "";
                    string StatusDecoded = "";
                    string TitleHeadingDecoded = "";
                    string BriefDescriptionDecoded = "";
                    string DescriptionFieldDecoded = "";
                    string RecruiterDecoded = "";
                    string JobtypeDecoded = "";
                    string RequisitionLink = "";
                    source.LoadHtml(browserJobVite.DocumentText);
                    try
                    {
                        foreach (HtmlNode Category in source.DocumentNode.SelectNodes("//table[@class=\"tableContent\"]/tr/td"))
                        {
                            if (Category.InnerText == "Categoria:")
                            {

                                CategoryDecoded = System.Net.WebUtility.HtmlDecode(Category.NextSibling.InnerText);
                                //txtLog.Text = txtLog.Text + "Categoria: " + CategoryDecoded + Environment.NewLine;
                                break;
                            }
                        }
                    }
                    catch(Exception e)
                    {}
                    try
                    {
                        foreach (HtmlNode City in source.DocumentNode.SelectNodes("//table[@class=\"tableContent\"]/tr/td"))
                        {
                            if (City.InnerText == "Cidade:")
                            {
                                CityDecoded = System.Net.WebUtility.HtmlDecode(City.NextSibling.InnerText);
                                //txtLog.Text = txtLog.Text + "Cidade: " + CityDecoded + Environment.NewLine;
                            }
                        }
                    }
                    catch(Exception e)
                    {}
                    try
                    {
                        foreach (HtmlNode Status in source.DocumentNode.SelectNodes("//span[@id=\"Status\"]"))
                        {
                            StatusDecoded = System.Net.WebUtility.HtmlDecode(Status.InnerHtml);
                            //txtLog.Text = txtLog.Text + StatusDecoded + Environment.NewLine;
                        }
                    }
                    catch(Exception e)
                    {}
                    try
                    {
                        //Nome da Requisition
                        foreach (HtmlNode TitleHeading in source.DocumentNode.SelectNodes("//span[@id=\"TitleHeading\"]"))
                        {
                            TitleHeadingDecoded = System.Net.WebUtility.HtmlDecode(TitleHeading.InnerText);
                            //txtLog.Text = txtLog.Text + TitleHeadingDecoded + Environment.NewLine;
                        }
                    }
                    catch(Exception e)
                    {}
                    try
                    {
                        foreach (HtmlNode BriefDescription in source.DocumentNode.SelectNodes("//span[@id=\"BriefDescription\"]"))
                        {
                            BriefDescriptionDecoded = System.Net.WebUtility.HtmlDecode(BriefDescription.InnerText);
                            //txtLog.Text = txtLog.Text + BriefDescriptionDecoded + Environment.NewLine;
                        }
                    }
                    catch(Exception e)
                    {}
                    try
                    {
                        //Big Description
                        foreach (HtmlNode DescriptionField in source.DocumentNode.SelectNodes("//span[@id=\"DescriptionField\"]"))
                        {
                            DescriptionFieldDecoded = System.Net.WebUtility.HtmlDecode(DescriptionField.InnerText);
                            //txtLog.Text = txtLog.Text + DescriptionFieldDecoded + Environment.NewLine;
                        }
                    }
                    catch(Exception e)
                    {}
                    try
                    {
                        foreach (HtmlNode Recruiter in source.DocumentNode.SelectNodes("//table[@class=\"tableContent\"]/tr/td"))
                        {
                            if (Recruiter.InnerText == "Recrutador:")
                            {
                                RecruiterDecoded = System.Net.WebUtility.HtmlDecode(Recruiter.NextSibling.InnerText);
                                //txtLog.Text = txtLog.Text + "Recruiter: " + RecruiterDecoded + Environment.NewLine + Environment.NewLine + Environment.NewLine;
                            }
                        }

                    }
                    catch(Exception e)
                    {}
                    try
                    {
                        foreach (HtmlNode Jobtype in source.DocumentNode.SelectNodes("//table[@class=\"tableContent\"]/tr/td"))
                        {
                            if (Jobtype.InnerText == "Tipo da Vaga:")
                            {
                                JobtypeDecoded = System.Net.WebUtility.HtmlDecode(Jobtype.NextSibling.InnerText);
                                //txtLog.Text = txtLog.Text + JobtypeDecoded + Environment.NewLine;
                            }
                        }
                    }
                    catch (Exception ex)
                    { }

                    try
                    {
                        foreach (HtmlNode RequisitionLinks in source.DocumentNode.SelectNodes("//table[@class=\"tableContent\"]/tr/td"))
                        {
                            if (RequisitionLinks.InnerText == "Candidates:")
                            {
                                RequisitionLink = RequisitionLinks.NextSibling.FirstChild.Attributes["href"].Value;
                                txtLog.Text = RequisitionLink;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                    try
                    {
                        //ADICIONAR AO BANCO
                        int CategoryId = 25;
                        int RecruiterId = 466;
                        int CityId = 5508;
                        int JobtypeId = 5;
                        using (grouponjobsdevEntities context = new grouponjobsdevEntities())
                        {
                            Requisition_Log log = new Requisition_Log();
                            try
                            {
                                CategoryId = context.Categories.Where(c => c.Name == CategoryDecoded).Select(c => c.CategoryId).First();
                            }
                            catch (Exception ex)
                            {
                                log.Adicionar(i.ToString(),TitleHeadingDecoded, "Category", CategoryDecoded, ex.Message);
                            }
                            try
                            {
                                RecruiterId = context.Recruiters.Where(r => r.Name == RecruiterDecoded).Select(r => r.RecruiterId).First();
                            }
                            catch (Exception ex)
                            {
                                log.Adicionar(i.ToString(),TitleHeadingDecoded, "Recruiter", RecruiterDecoded, ex.Message);
                            }
                            try
                            {
                                CityId = context.Cities.Where(c => c.Name == CityDecoded).Select(c => c.CityId).First();
                            }
                            catch (Exception ex)
                            {
                                log.Adicionar(i.ToString(),TitleHeadingDecoded, "City", CityDecoded, ex.Message);
                            }
                            try
                            {
                                JobtypeId = context.Jobtypes.Where(j => j.Name == JobtypeDecoded).Select(j => j.JobtypeId).First();
                            }
                            catch (Exception ex)
                            {
                                //log.Adicionar(i.ToString(),TitleHeadingDecoded, "Jobtype", JobtypeDecoded, ex.Message);
                            }
                            //txtLog.Text = CategoryId.ToString() + " " + RecruiterId.ToString() + " " + CityId.ToString() + " " + JobtypeId.ToString();
                            Requisition req = new Requisition();
                            req.Adicionar(TitleHeadingDecoded, RecruiterId, StatusDecoded, BriefDescriptionDecoded, DescriptionFieldDecoded, CityId, CategoryId, JobtypeId, RequisitionLink);

                        }
                    }
                    catch (Exception ex)
                    {
                        txtLog.Text = ex.ToString();
                    }

                }
                browserJobVite.Navigate(new Uri("https://hire.jobvite.com/Hiring/ViewJob.aspx?v=4&js=1023&vr=1&id=" + i));
            }
        }
コード例 #6
0
ファイル: Candidate.cs プロジェクト: bfxavier/JobsCrawler
        private void navigate()
        {
            string FirstName = "";
            string LastName = "";
            string EMailDecoded = "";
            string ResumeDecoded = "";
            string Rating = "";
            string Disposition = "";
            string WorkFlowDecoded = "";
            string CityDecoded = "";
            int RatingId = 0;
            int DispositionId = 0;
            int requisitionInitialId;
            int countRequisitions;
            int inicio = int.Parse(txtInicio.Text);
            int fim = int.Parse(txtFim.Text);
            bool hasnotes = true;
            string[] messages = new string[100];
            int contador = inicio;
            int totalId = 0;
            try
            {

                bool erro = false;
                using (grouponjobsdevEntities context = new grouponjobsdevEntities())
                {
                    countRequisitions = context.Requisitions.Count();
                    requisitionInitialId = context.Requisitions.Select(r => r.RequisitionId).First();
                }

                for (int l = inicio; contador <= fim; l++)
                {
                    string RequisitionLink = "";
                    erro = true;
                    hasnotes = true;
                    try
                    {
                        totalId = requisitionInitialId + contador;
                        using (grouponjobsdevEntities context = new grouponjobsdevEntities())
                        {
                            RequisitionLink = context.Requisitions.Where(r => r.RequisitionId == totalId).Select(r => r.RequisitionLink).First();
                        }
                        browserJobVite.Navigate(new Uri("https://hire.jobvite.com/Hiring/" + RequisitionLink));
                        while (browserJobVite.ReadyState != WebBrowserReadyState.Complete)
                        {
                            Application.DoEvents();
                        }

                        if (RequisitionLink != "")
                        {

                            foreach (HtmlElement e in browserJobVite.Document.GetElementsByTagName("a"))
                            {
                                if (e.GetAttribute("classname") == "jv-redirectCandidate")
                                {
                                    e.InvokeMember("Click");
                                    break;
                                }
                            }

                            while (browserJobVite.ReadyState != WebBrowserReadyState.Complete)
                            {
                                Application.DoEvents();
                            }
                            iMax = ContagemCandidatos();
                            //MessageBox.Show(iMax.ToString());
                            //MessageBox.Show(RequisitionLink);
                            erro = false;
                        }
                        contador++;
                    }
                    catch (Exception ex)
                    {

                        erro = true;
                    }

                    for (int n = 0; n < iMax; n++)
                    {
                        while (browserJobVite.ReadyState != WebBrowserReadyState.Complete)
                        {
                            Application.DoEvents();
                        }

                        if (erro == false)
                        {
                            hasnotes = true;
                            source.LoadHtml(browserJobVite.DocumentText);
                            foreach (HtmlNode TitleHeader in source.DocumentNode.SelectNodes("//span[@id=\"TitleHeader\"]"))
                            {
                                string TitleHeaderDecoded = System.Net.WebUtility.HtmlDecode(TitleHeader.InnerText);
                                string[] nameSplit = TitleHeaderDecoded.Split(' ');
                                FirstName = nameSplit[0];
                                LastName = concatenaLastName(nameSplit);
                                txtLog.Text = txtLog.Text + FirstName + " " + LastName + Environment.NewLine;
                            }
                            foreach (HtmlNode WorkFlow in source.DocumentNode.SelectNodes("//span[@id=\"candidateStatus\"]"))
                            {
                                WorkFlowDecoded = System.Net.WebUtility.HtmlDecode(WorkFlow.InnerText);
                                txtLog.Text = txtLog.Text + WorkFlowDecoded + Environment.NewLine;
                            }
                            foreach (HtmlNode EMail in source.DocumentNode.SelectNodes("//span[@id=\"Email\"]"))
                            {
                                EMailDecoded = System.Net.WebUtility.HtmlDecode(EMail.InnerText);
                                txtLog.Text = txtLog.Text + EMailDecoded + Environment.NewLine;
                            }
                            foreach (HtmlNode Resume in source.DocumentNode.SelectNodes("//span[@id=\"Resume\"]"))
                            {
                                ResumeDecoded = Resume.InnerText;
                                txtLog.Text = txtLog.Text + ResumeDecoded + Environment.NewLine;
                            }
                            foreach (HtmlNode City in source.DocumentNode.SelectNodes("//span[@id=\"City\"]"))
                            {
                                CityDecoded = System.Net.WebUtility.HtmlDecode(City.InnerText);
                                //txtLog.Text = txtLog.Text + "Cidade: " + CityDecoded + Environment.NewLine;
                            }
                            int z = 0;
                            try
                            {
                                foreach (HtmlNode Notes in source.DocumentNode.SelectNodes("//span[@id=\"msgSpan0\"]/table/tr/td"))
                                {
                                    if (!string.IsNullOrEmpty(Notes.InnerText))
                                    {
                                        messages[z] = Notes.InnerText;
                                        z++;
                                    }
                                }
                            }
                            catch
                            {
                                hasnotes = false;
                            }

                            //teste de dropdown list

                            var menus = source.DocumentNode.Descendants("select");
                            int k = 0;
                            string[] ddlvalues = new string[3];
                            foreach (var element in menus)
                            {
                                ddlvalues[k] = AddMenuElement(element);
                                k++;
                            }
                            switch (ddlvalues[1])
                            {
                                case "5601":
                                    ddlvalues[1] = "Não avaliado";
                                    break;
                                case "5602":
                                    ddlvalues[1] = "Não qualificado";
                                    break;
                                case "5604":
                                    ddlvalues[1] = "Talvez";
                                    break;
                                case "5605":
                                    ddlvalues[1] = "Bom";
                                    break;
                                case "5606":
                                    ddlvalues[1] = "Preferido";
                                    break;
                                case "5607":
                                    ddlvalues[1] = "Super qualificado";
                                    break;
                                case "5608":
                                    ddlvalues[1] = "Sem interesse";
                                    break;
                            }

                            switch (ddlvalues[2])
                            {
                                case "F3SaVfwK":
                                    ddlvalues[2] = "Não avaliado";
                                    break;
                                case "FCLaVfwc":
                                    ddlvalues[2] = "Fora do Perfil";
                                    break;
                                case "FDLaVfwd":
                                    ddlvalues[2] = "Abordado e Fora do Perfil";
                                    break;
                                case "FELaVfwe":
                                    ddlvalues[2] = "Entrevistado e Fora do Perfil";
                                    break;
                                case "FFLaVfwf":
                                    ddlvalues[2] = "Entrevista Groupon";
                                    break;
                                case "FGLaVfwg":
                                    ddlvalues[2] = "Em Avaliação";
                                    break;
                                case "FcSaVfwT":
                                    ddlvalues[2] = "Sem interesse";
                                    break;
                                case "FHLaVfwh":
                                    ddlvalues[2] = "Proposta";
                                    break;
                                case "FILaVfwi":
                                    ddlvalues[2] = "Rejeitou Proposta";
                                    break;
                                case "FJLaVfwj":
                                    ddlvalues[2] = "Contratado!";
                                    break;
                            }
                            Rating = ddlvalues[1];
                            Disposition = ddlvalues[2];
                            int CityId = 5508;
                            using (grouponjobsdevEntities context = new grouponjobsdevEntities())
                            {
                                Candidate_Log log = new Candidate_Log();
                                try
                                {
                                    RatingId = context.Candidate_Rating.Where(cr => cr.Name == Rating).Select(cr => cr.RatingId).First();
                                }
                                catch (Exception ex)
                                {
                                    RatingId = 1;
                                    log.Adicionar(FirstName + " " + LastName, "Rating", Rating, ex.Message);
                                }
                                try
                                {
                                    DispositionId = context.Candidate_Disposition.Where(cd => cd.Name == Disposition).Select(cd => cd.DispositionId).First();
                                }

                                catch (Exception ex)
                                {
                                    DispositionId = 3;
                                    log.Adicionar(FirstName + " " + LastName, "Disposition", Disposition, ex.Message);
                                }
                                try
                                {
                                    CityId = context.Cities.Where(c => c.Name == CityDecoded).Select(c => c.CityId).First();
                                }
                                catch (Exception ex)
                                {

                                    log.Adicionar(FirstName + " " + LastName, "City", CityDecoded, ex.Message);
                                }

                                try
                                {
                                    JobsCrawler.DAL.Candidate cand = new JobsCrawler.DAL.Candidate();
                                    cand.Adicionar(FirstName, LastName, RatingId, DispositionId, totalId, ResumeDecoded, WorkFlowDecoded, CityId);
                                }
                                catch (Exception ex)
                                {
                                }
                                if (hasnotes == true)
                                {
                                    try
                                    {
                                        foreach (string Nota in messages)
                                        {
                                            if (!string.IsNullOrEmpty(Nota))
                                            {
                                                Candidate_Note note = new Candidate_Note();
                                                int CandidateId;
                                                CandidateId = context.Candidates.Where(c => c.FirstName == FirstName && c.LastName == LastName).Select(c => c.CandidateId).First();
                                                note.Adicionar(CandidateId, Nota);
                                            }
                                        }
                                    }
                                    catch
                                    {
                                    }

                                }

                            }

                            browserJobVite.Navigate(new Uri("https://hire.jobvite.com/Hiring/ViewCandidate.aspx?v=14&id=" + (n + 1)));
                        }

                    }
                }

            }
            catch (Exception ex)
            {
                txtLog.Text = ex.ToString();
            }
        }
コード例 #7
0
ファイル: JobsExtension.cs プロジェクト: bfxavier/JobsCrawler
 public void Adicionar(string Name, int RecruiterId, string Status, string SmallDescription, string BigDescription, int CityId, int CategoryId, int JobtypeId, string RequisitionLink)
 {
     using (grouponjobsdevEntities context = new grouponjobsdevEntities())
     {
         Requisition req = new Requisition();
         req.Name = Name;
         req.RecruiterId = RecruiterId;
         req.Status = Status;
         req.SmallDescription = SmallDescription;
         req.BigDescription = BigDescription;
         req.CityId = CityId;
         req.CategoryId = CategoryId;
         req.JobtypeId = JobtypeId;
         req.RequisitionLink = RequisitionLink;
         context.Requisitions.AddObject(req);
         context.SaveChanges();
     }
 }
コード例 #8
0
ファイル: JobsExtension.cs プロジェクト: bfxavier/JobsCrawler
 public void Adicionar(string NavigateId,string RequisitionName, string CampoErrado, string ValorErrado, string ex)
 {
     using (grouponjobsdevEntities context = new grouponjobsdevEntities())
     {
         Requisition_Log log = new Requisition_Log();
         log.NavigateId = int.Parse(NavigateId);
         log.RequisitionName = RequisitionName;
         log.CampoErrado = CampoErrado;
         log.ValorErrado = ValorErrado;
         log.Exception = ex;
         context.Requisition_Log.AddObject(log);
         context.SaveChanges();
     }
 }