示例#1
0
        public PesquisaViewModel()
        {
            // _pesquisaCPFCNPJ = Global.Investidor;
            pesquisaBusiness = new PesquisaBusiness();

            PesquisaCPFCNPJ = new PesquisaCPFCNPJModel();

            PesquisarClickedCommand = new Command(() => {
                var mensagem = "Consulta Realizada com Sucesso";
                try
                {
                    ArpenspModel arpenspModel = pesquisaBusiness.Arpensp(PesquisaCPFCNPJ.CPFCNPJ);
                    CagedModel cagedModel     = pesquisaBusiness.Caged(PesquisaCPFCNPJ.CPFCNPJ);
                    JucespModel jucespModel   = pesquisaBusiness.Jucesp(PesquisaCPFCNPJ.CPFCNPJ);
                    CensecModel censecModel   = pesquisaBusiness.Censec(PesquisaCPFCNPJ.CPFCNPJ);
                    SielModel sielModel       = pesquisaBusiness.Siel(PesquisaCPFCNPJ.CPFCNPJ);
                    SivecModel sivecModel     = pesquisaBusiness.Sivec(PesquisaCPFCNPJ.CPFCNPJ);
                    DetranModel detranModel   = pesquisaBusiness.Detran(PesquisaCPFCNPJ.CPFCNPJ);
                } catch (Exception ex) {
                    mensagem = "Não foi possível consultar os dados. Verifique sua conexão! \n Detalhe: " +
                               ex.Message;
                }

                DependencyService.Get <IMessage>().ShortAlert(mensagem);
                MessagingCenter.Send <PesquisaViewModel>(this, "PesquisaSucesso");
            });
        }
示例#2
0
 public void Insert(CagedModel cagedModel)
 {
     using (context)
     {
         context.Caged.Add(cagedModel);
         context.SaveChanges();
     }
 }
示例#3
0
        public CagedModel Caged(int cpfcnpj)
        {
            var caged = new Service.PesquisaService().Caged(cpfcnpj);

            CagedModel cagedModel = JsonConvert.DeserializeObject <CagedModel>(caged);

            //variavel global
            Global.Caged = cagedModel;

            return(cagedModel);
        }
示例#4
0
        public string Caged(PesquisaCPFCNPJ pesquisaCPFCNPJ)
        {
            var options = new ChromeOptions();

            options.AddArguments("headless");
            using (IWebDriver driver = new ChromeDriver("C:/inetpub/wwwroot/wwwroot", options))
            //using (IWebDriver driver = new ChromeDriver(options))
            {
                Actions builder = new Actions(driver);

                driver.Navigate().GoToUrl("http://ec2-18-231-116-58.sa-east-1.compute.amazonaws.com/caged/login.html");
                driver.FindElement(By.Id("btn-submit")).Click();
                driver.Navigate().GoToUrl("http://ec2-18-231-116-58.sa-east-1.compute.amazonaws.com/caged/pagina3-consulta-autorizado-responsavel.html");
                driver.FindElement(By.Id("formPesquisarAutorizado:txtChavePesquisaAutorizado014")).SendKeys(pesquisaCPFCNPJ.CPFCNPJ.ToString());
                driver.FindElement(By.Id("formPesquisarAutorizado:bt027_8")).Click();

                var resultado = driver.FindElement(By.XPath("//*[@id='conteudo']/fieldset[3]")).Text;

                string[] strsplit = resultado.Replace("\r\n", ":").Split(':');

                string nome     = strsplit[1].Trim();
                string telefone = strsplit[9].Trim();
                string ramal    = strsplit[12].Trim();
                string email    = strsplit[15].Trim();

                CagedModel objCa = new CagedModel();
                objCa.CNPJCaged = pesquisaCPFCNPJ.CPFCNPJ;
                objCa.Nome      = nome;
                objCa.Telefone  = telefone;
                objCa.Ramal     = ramal;
                objCa.Email     = email;

                cagedRepository.Insert(objCa);

                string objjsonData = JsonConvert.SerializeObject(objCa);

                //System.IO.File.WriteAllText(@"C:\Users\favar\Desktop\Texto\Caged.txt", objjsonData);

                return(objjsonData);
            }
        }
示例#5
0
        public ActionResult RelatorioSimplificado(PesquisaCPFCNPJ pesquisaCPFCNPJ)
        {
            string arpensp = "";
            string cadesp  = "";
            string caged   = "";
            string censec  = "";
            string detran  = "";
            string juscesp = "";
            string siel    = "";
            string sivec   = "";

            if (pesquisaCPFCNPJ.Arpensp == "on")
            {
                arpensp = webScraping.Arpensp(pesquisaCPFCNPJ);
            }
            if (pesquisaCPFCNPJ.Cadesp == "on")
            {
                cadesp = webScraping.Cadesp(pesquisaCPFCNPJ);
            }
            if (pesquisaCPFCNPJ.Caged == "on")
            {
                caged = webScraping.Caged(pesquisaCPFCNPJ);
            }
            if (pesquisaCPFCNPJ.Censec == "on")
            {
                censec = webScraping.Censec(pesquisaCPFCNPJ);
            }
            if (pesquisaCPFCNPJ.Jucesp == "on")
            {
                juscesp = webScraping.Jucesp(pesquisaCPFCNPJ);
            }
            if (pesquisaCPFCNPJ.Detran == "on")
            {
                detran = webScraping.Detran(pesquisaCPFCNPJ);
            }
            if (pesquisaCPFCNPJ.Siel == "on")
            {
                siel = webScraping.Siel(pesquisaCPFCNPJ);
            }
            if (pesquisaCPFCNPJ.Sivec == "on")
            {
                sivec = webScraping.Sivec(pesquisaCPFCNPJ);
            }



            ArpenspModel arpenspModel = relatorioSimplificadoRepository.SimplesArpensp(arpensp);
            CadespModel  cadespModel  = relatorioSimplificadoRepository.SimplesCadesp(cadesp);
            JucespModel  jucespModel  = relatorioSimplificadoRepository.SimplesJucesp(juscesp);
            CagedModel   cagedModel   = relatorioSimplificadoRepository.SimplesCaged(caged);
            DetranModel  detranModel  = relatorioSimplificadoRepository.SimplesDetran(detran);
            CensecModel  censecModel  = relatorioSimplificadoRepository.SimplesCensec(censec);
            SielModel    sielModel    = relatorioSimplificadoRepository.SimplesSiel(siel);
            SivecModel   sivecModel   = relatorioSimplificadoRepository.SimplesSivec(sivec);

            consultaAnteriorRepository.Insert(pesquisaCPFCNPJ);

            return(View(new PesquisaCPFCNPJ()
            {
                ArpenspModel = arpenspModel, CadespModel = cadespModel, JucespModel = jucespModel, CagedModel = cagedModel, DetranModel = detranModel, CensecModel = censecModel, SielModel = sielModel, SivecModel = sivecModel
            }));
        }
        public CagedModel SimplesCaged(string caged)
        {
            CagedModel cagedModel = JsonConvert.DeserializeObject <CagedModel>(caged);

            return(cagedModel);
        }