public MainWindow()
 {
     InitializeComponent();
     _leitorCSV  = new LeitorCSV();
     _leitorJSON = new LeitorJSON();
     _seloCtrl   = new SeloController(@"https://cidadao.portalseloam.com.br/portal-selo/selos/consulta");
 }
Beispiel #2
0
        static async Task Main(string[] args)
        {
            LeitorCSV       leitorDeCeps     = new LeitorCSV(@"../CEPs.csv");
            EscritorCSV     EscritordeCeps   = new EscritorCSV(@"CEPs2.csv");
            List <string>   listaDeCeps      = leitorDeCeps.LerTodosOsCeps();
            ClienteViaCep   cliente          = new ClienteViaCep();
            List <Endereco> listaDeEnderecos = new List <Endereco>();

            foreach (string cep in listaDeCeps)
            {
                try
                {
                    Endereco novoEndereco = await cliente.Busca(cep);

                    listaDeEnderecos.Add(novoEndereco);
                }
                catch (CepInvalidoException e)
                {
                    Console.WriteLine("CEP com formato inválido");
                }
                catch (Exception e2)
                {
                    Console.WriteLine("Não foi possível realizar a requisiçao");
                }
            }
            EscritordeCeps.EscreverTodasAsLinhas(leitorDeCeps.getCabecalho(), listaDeEnderecos);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            LeitorCSV     leitorCSVMapa       = new LeitorCSV(@"../mapa.csv");
            EscritorCSV   escritorCSVNovoMapa = new EscritorCSV(@"mapa2.csv");
            List <Cidade> listaDeCidades      = leitorCSVMapa.LerTodasAsLinhas();

            BubbleSort ordenador = new BubbleSort();

            ordenador.orderna(listaDeCidades);

            escritorCSVNovoMapa.EscreverTodasAsLinhas(leitorCSVMapa.getCabecalho(), listaDeCidades);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            LeitorCSV     leitorCSVMapa       = new LeitorCSV(@"../mapa.csv");
            EscritorCSV   escritorCSVNovoMapa = new EscritorCSV(@"mapa2.csv");
            List <Cidade> linhasAntigas       = leitorCSVMapa.LerTodasAsLinhas();

            List <Cidade> linhasNovas = new List <Cidade> ();

            foreach (Cidade cidade in linhasAntigas)
            {
                Cidade novaCidade = new Cidade(cidade.getCidade(), cidade.getPopulacao() * 2);
                linhasNovas.Add(novaCidade);
            }
            escritorCSVNovoMapa.EscreverTodasAsLinhas(leitorCSVMapa.getCabecalho(), linhasNovas);
        }
Beispiel #5
0
 public LeitorCSVTests()
 {
     leitor = new LeitorCSV();
     path   = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CSV", "Resources", "SELOS-Apenas1Selo.csv");
 }