Пример #1
0
        static void Main(string[] args)
        {
            // create zipcode service client
            var zipcodeSvc = new ZipCodeServiceClient();

            // prompt for username
            Console.Write("Enter username: "******"Enter a zipcode (return to exit): ");
                var zipcode = Console.ReadLine();

                // exit on blank zipcode
                if (string.IsNullOrEmpty(zipcode)) break;

                // invoke service to perform lookup
                var cityState = zipcodeSvc.Lookup(user, zipcode);

                // output results to console.
                Console.WriteLine(cityState);

            } while (true);
        }
Пример #2
0
        static void Main(string[] args)
        {
            // create zipcode service client
            var zipcodeSvc = new ZipCodeServiceClient();

            // prompt for username
            Console.Write("Enter username: "******"Enter a zipcode (return to exit): ");
                var zipcode = Console.ReadLine();

                // exit on blank zipcode
                if (string.IsNullOrEmpty(zipcode))
                {
                    break;
                }

                // invoke service to perform lookup
                var cityState = zipcodeSvc.Lookup(user, zipcode);

                // output results to console.
                Console.WriteLine(cityState);
            } while (true);
        }
Пример #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the ZipCode lookup program!");
            Console.WriteLine("Enter a zipcode in the following format: #####-####");
            Console.WriteLine("Or enter 'quit' to close the program.\n");
            Console.WriteLine("Some sample zip codes: 84041-2941, 97206-6825, 85383-8718\n");

            ZipCodeServiceClient client = new ZipCodeServiceClient();

            string zipcode = Console.ReadLine();

            while (!zipcode.Equals("quit"))
            {
                try
                {
                    Console.WriteLine(client.Lookup(zipcode));
                }
                catch (FaultException fe)
                {
                    Console.WriteLine(fe.Message);
                }
                zipcode = Console.ReadLine();
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the ZipCode lookup program!");
            Console.WriteLine("Enter a zipcode in the following format: #####-####");
            Console.WriteLine("Or enter 'quit' to close the program.\n");
            Console.WriteLine("Some sample zip codes: 84041-2941, 97206-6825, 85383-8718\n");

            ZipCodeServiceClient client = new ZipCodeServiceClient();

            string zipcode = Console.ReadLine();

            while (!zipcode.Equals("quit"))
            {
                try
                {
                    Console.WriteLine(client.Lookup(zipcode));
                }
                catch (FaultException fe)
                {
                    Console.WriteLine(fe.Message);
                }
                zipcode = Console.ReadLine();
            }
        }