Beispiel #1
0
    ///Classe Base de CEP Menu
    public static void CEP_Menu()
    {
        Console.Clear();
        int    option = 0;
        string cep    = "";
        string log    = "";
        //int op = 0;
        string title3 = @"
			
            ____                         __        ________________ 
           / __ )____ _________     ____/ ___     / ____/ ____/ __ \
          / __  / __ `/ ___/ _ \   / __  / _ \   / /   / __/ / /_/ /
         / /_/ / /_/ (__  /  __/  / /_/ /  __/  / /___/ /___/ ____/ 
        /_____/\__,_/____/\___/   \__,_/\___/   \____/_____/_/      
                                                            
		"        ;

        Console.Beep(440, 300);
        Console.WriteLine();
        Console.WriteLine(new string(':', 75));
        Console.WriteLine(title3);
        Console.WriteLine(new string(':', 75));
        Console.WriteLine("\nPESQUISAR POR: \n");
        Console.WriteLine("[1] - CEP");
        Console.WriteLine("[2] - Logradouro");
        Console.WriteLine("\n[3] - Menu");
        Console.Write("\n> ");

        try
        {
            option = Convert.ToInt32(Console.ReadLine());
        }
        catch (System.FormatException e)
        {
            Console.WriteLine("ERROR {0}", e);
            Console.WriteLine("Press any button to continue...");
            Console.ReadKey();
        }
        if (option == 1)
        {
            Console.Write("\nCEP: ");
            Console.ForegroundColor = ConsoleColor.Green;
            cep = Console.ReadLine();
            Console.ForegroundColor = ConsoleColor.Gray;

            var c_return_1 = CEP.Pesquisa_Cep_1(cep);

            Console.WriteLine("							  {0}", c_return_1[6]);
            Console.WriteLine(new string('_', 75));
            Console.Write("\nCidade: ");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(c_return_1[1]);
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.Write("\nUF: ");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(c_return_1[2]);
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.Write("\nBairro: ");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(c_return_1[3]);
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.Write("\nLogradouro: ");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(c_return_1[4]);
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.Write("\nComplemento: ");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(c_return_1[5]);
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine(new string('_', 75));
            Console.WriteLine("\n\nPress any button to continue...");
            Console.ReadKey();
            CEP_Menu();
        }
        else if (option == 2)
        {
            Console.Write("\nLOGRADOURO: ");
            Console.ForegroundColor = ConsoleColor.Green;
            log = Console.ReadLine();
            Console.ForegroundColor = ConsoleColor.Gray;

            var c_return_2 = CEP.Pesquisa_Cep_1(log);
            Console.WriteLine(new string('_', 75));
            Console.Write("\nCidade: ");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(c_return_2[1]);
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.Write("\nUF: ");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(c_return_2[2]);
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.Write("\nBairro: ");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(c_return_2[3]);
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.Write("\nCEP: ");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(c_return_2[0]);
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.Write("\nComplemento: ");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(c_return_2[5]);
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine(new string('_', 75));
            Console.WriteLine("\n\nPress any button to continue...");
            Console.ReadKey();
            CEP_Menu();
        }
        else if (option == 3)
        {
            Main();
        }
        else
        {
            CEP_Menu();
        }
    }