private void BtnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(txtState.Text))
                {
                    var address = new EndpointAddress("net.tcp://localhost/GeoLib.WebHost/GeoService.svc");
                    var binding = new NetTcpBinding();

                    GeoClient proxy = new GeoClient(binding, address);
                    IEnumerable <ZipCodeData> data = proxy.GetZips(txtState.Text);

                    if (data != null)
                    {
                        lstZips.ItemsSource = data;
                    }

                    proxy.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 2
0
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            //This call, in the way it's configured, will only work with ConsoleHost
            if (!string.IsNullOrWhiteSpace(txtSearchState.Text))
            {
                //As commented in the module, it's possible to set values in the config file or programmatically.
                //Here it was set programmatically, to change this, you just need to comment the next lines,
                //and make the constructor passing the tcpEP string as parameter.
                EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
                Binding         binding = new NetTcpBinding()
                {
                    MaxReceivedMessageSize = 2000000,
                    SendTimeout            = new TimeSpan(0, 0, 5)
                };

                GeoClient proxy = new GeoClient(binding, address);

                IEnumerable <ZipCodeData> data = proxy.GetZips(txtSearchState.Text);
                if (data != null)
                {
                    lstZips.ItemsSource = data;
                }

                proxy.Close();
            }
        }
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            if (txtState.Text != null)
            {
                GeoClient proxy = new GeoClient();

                IEnumerable <ZipCode> data = proxy.GetZips(txtState.Text);
                if (data != null)
                {
                    lstZips.ItemsSource = data;
                }

                proxy.Close();
            }
        }
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            if (txtState.Text != "")
            {
                EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
                Binding         binding = new NetTcpBinding();
                GeoClient       proxy   = new GeoClient(binding, address);

                IEnumerable <ZipCodeData> data = proxy.GetZips(txtState.Text);
                if (data != null)
                {
                    lstZipCodes.ItemsSource = data;
                }
                proxy.Close();
            }
        }
        public void GetZipCodes()
        {
            var tempProxy = new GeoClient("tcpEP");
            if (string.IsNullOrEmpty(State)) return;

            var data = tempProxy.GetZips(State);

            this.ZipCodes.Clear();

            foreach (var zipCodeData in data)
            {
                this.ZipCodes.Add(zipCodeData);
            }
            
            tempProxy.Close();
        }
Esempio n. 6
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtState.Text))
            {
                EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
                System.ServiceModel.Channels.Binding bind = new NetTcpBinding();
                GeoClient client = new GeoClient(bind, address);
                var       result = client.GetZips(txtState.Text);
                if (result != null)
                {
                    lstZips.ItemsSource = result;
                }

                client.Close();
            }
        }
        private void BtnGetZipCodes_OnClick(object sender, RoutedEventArgs e)
        {
            if (txtState != null)
            {
                EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
                Binding binding = new NetTcpBinding();

                GeoClient proxy = new GeoClient(binding, address);

                var datas = proxy.GetZips(txtState.Text);

                if (datas != null)
                {
                    lstZips.ItemsSource = datas;
                }
            }
        }
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            if (txtState.Text == "") return;

            EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
            NetTcpBinding binding = new NetTcpBinding();
            binding.MaxReceivedMessageSize = 2097152;

            using (GeoClient client = new GeoClient(binding, address))
            {
                IEnumerable<ZipCodeData> data = client.GetZips(txtState.Text);

                if (data == null) return;

                lstZips.ItemsSource = data;

            }
        }
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            if (txtState.Text != null)
            {
                //GeoClient proxy = new GeoClient();
                //IGeoService proxy = CreateProxy();
                GeoClient proxy = new GeoClient("dynamicGeoService");

                IEnumerable <ZipCodeData> data = proxy.GetZips(txtState.Text);
                if (data != null)
                {
                    lstZips.ItemsSource = data;
                }

                ((IDisposable)proxy).Dispose();
                //proxy.Close();
            }
        }
Esempio n. 10
0
        private void GetZipCodesBtn_OnClick(object sender, RoutedEventArgs e)
        {
            var address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
            var binding = new NetTcpBinding();
            var proxy   = new GeoClient(binding, address);

            ZipCodeData[] data = proxy.GetZips("");

            var sb = new StringBuilder();

            foreach (var zipCodeData in data)
            {
                sb.AppendLine($"State: {zipCodeData.State} City: {zipCodeData.City} ZipCode: {zipCodeData.ZipCode}");
            }

            GetZipsTextBLock.Text = sb.ToString();
            proxy.Close();
        }
Esempio n. 11
0
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txtState.Text))
            {
                return;
            }
            var     endpointAddress = new EndpointAddress("net.tcp://localhost:8009/GeoService");
            Binding binding         = new NetTcpBinding();

            var proxy = new GeoClient(binding, endpointAddress);
            var data  = proxy.GetZips(txtState.Text);

            if (data != null)
            {
                lstZips.ItemsSource = data;
            }
            proxy.Close();
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            System.Console.Write("Enter Zip code:");
            var zip = System.Console.ReadLine();

            System.Console.Write("Enter old state abbrivation:");
            var oldstate = System.Console.ReadLine();

            System.Console.Write("Enter new state abbrivation:");
            var newstate = System.Console.ReadLine();

            GeoClient proxy = new GeoClient();

            try
            {
                var result      = proxy.GetStates(true);
                var zipsByState = proxy.GetZips(new ZipCode()
                {
                    County = "India"
                }, 1);

                var zipcodeByInfo = proxy.GetZipInfo(zip);

                GeoAdminClient adminClient = new GeoAdminClient();
                adminClient.ClientCredentials.UserName.UserName = "******";
                adminClient.ClientCredentials.UserName.Password = "******";

                adminClient.UpdateState(oldstate, newstate);
                //  var allZipCodes = proxy.GetZips(new ZipCode() { }, 1);
                System.Console.Write("State:");
                System.Console.WriteLine(null != zipcodeByInfo.State ? zipcodeByInfo.State.Name : string.Empty);
                System.Console.Write("City:");
                System.Console.WriteLine(null != zipcodeByInfo.City ? zipcodeByInfo.City : string.Empty);
            }
            finally
            {
                //  proxy.Close();
            }

            System.Console.ReadLine();
        }
Esempio n. 13
0
        private void bthGetZipCodes_Click( object sender, RoutedEventArgs e )
        {
            if (txtState.Text != "")
            {
                //GeoClient proxy = new GeoClient("httpEP");

                EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
                System.ServiceModel.Channels.Binding binding = new NetTcpBinding();

                GeoClient proxy = new GeoClient(binding, address);

                IEnumerable<ZipCodeData> data = proxy.GetZips(txtState.Text);

                if (data != null)
                {
                    lstZips.ItemsSource = data;
                }

                proxy.Close();
            }
        }
Esempio n. 14
0
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            if (txtState.Text != null)
            {
                EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
                Binding         binding = new NetTcpBinding();
                binding.SendTimeout = new TimeSpan(0, 0, 0, 5);
                ((NetTcpBinding)binding).MaxReceivedMessageSize = 2000000;

                GeoClient proxy = new GeoClient(binding, address);



                IEnumerable <ZipCodeData> data = proxy.GetZips(txtState.Text);
                if (data != null)
                {
                    lbxResponse.ItemsSource = data;
                }
                proxy.Close();
            }
        }
Esempio n. 15
0
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            if(txtState.Text != "")
            {
                GeoClient proxy = new GeoClient(endpointName);
                IEnumerable<ZipCodeData> zipCodeData = proxy.GetZips(txtState.Text);
                if (zipCodeData != null)
                {
                    lstZips.ItemsSource = zipCodeData;
                }
                proxy.Close();

                //EndpointAddress endpointAddress = new EndpointAddress("net.tcp://localhost:11001/GeoService");
                //System.ServiceModel.Channels.Binding binding = new NetTcpBinding();
                //GeoClient proxy = new GeoClient(binding, endpointAddress);
                //IEnumerable<ZipCodeData> zipCodeData = proxy.GetZips(txtState.Text);
                //if(zipCodeData!=null)
                //{
                //    lstZips.ItemsSource = zipCodeData;
                //}
                //proxy.Close();
            }
        }
Esempio n. 16
0
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            //Here we will do no config for proxy
            //the client little more knowledge of wcf becuase proxy need this programattic end point
            //config info and this is fed through ctor overload.
            if (txtState.Text != null)
            {
                //EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
                //NetTcpBinding binding = new NetTcpBinding();
                //binding.Name = "dynamic";
                //binding.MaxReceivedMessageSize = 2000000;
                //GeoClient proxy = new GeoClient(binding, address);

                GeoClient proxy = new GeoClient("tcpEP");

                IEnumerable<ZipCodeData> data = proxy.GetZips(txtState.Text);
                if (data != null)
                    lstZips.ItemsSource = data;
                proxy.Close();
            }
        }