private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient();

                try
                {
                    ZipCode data = proxy.GetZipInfo(txtZipCode.Text);
                    if (data != null)
                    {
                        lblCity.Content  = data.City;
                        lblState.Content = data.State.Name;
                    }

                    proxy.Close();
                }
                catch (FaultException ex)
                {
                    MessageBox.Show("Fault Exception: " + ex.Message);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
示例#2
0
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient();

                try
                {
                    ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);
                    if (data != null)
                    {
                        lblCity.Content  = data.City;
                        lblState.Content = data.State;
                    }

                    proxy.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\n\r" +
                                    "Proxy state: " + proxy.State.ToString());
                }
            }
        }
示例#3
0
        private void GetInfoBtn_OnClick(object sender, RoutedEventArgs e)
        {
            var proxy = new GeoClient();

            ZipCodeData data = proxy.GetZipInfo("");

            GetInfoTextBlock.Text = $"{data.City} \r\n {data.State} \r\n {data.ZipCode}";

            proxy.Close();
        }
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient(new InstanceContext(this), "tcpEp");

                try
                {
                    ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);

                    if (data != null)
                    {
                        lblCity.Content  = data.City;
                        lblState.Content = data.State;
                    }
                    else
                    {
                        lblCity.Content  = "N/A";
                        lblState.Content = "N/A";
                    }
                    proxy.Close();
                }
                catch (FaultException <ExceptionDetail> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    "FaultException<ExceptionDetail>" + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (FaultException <ApplicationException> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    "FaultException<ApplicationException>" + "\n\r" +
                                    "Reason: " + ex.Message + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (FaultException <NotFoundData> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    "FaultException<NotFoundData>" + "\n\r" +
                                    "Reason: " + ex.Message + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (FaultException ex)
                {
                    MessageBox.Show("Faultxception thrown by service.\n\rException type: " +
                                    "FaultException" + "\n\r" +
                                    "Message: " + ex.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " + ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
            }
        }
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient(new InstanceContext(this), "tcpEp");

                try
                {
                    ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);

                    if (data != null)
                    {
                        lblCity.Content = data.City;
                        lblState.Content = data.State;
                    }
                    else
                    {
                        lblCity.Content = "N/A";
                        lblState.Content = "N/A";
                    }
                    proxy.Close();
                }
                catch (FaultException<ExceptionDetail> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    "FaultException<ExceptionDetail>" + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (FaultException<ApplicationException> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    "FaultException<ApplicationException>" + "\n\r" +
                                    "Reason: " + ex.Message + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (FaultException<NotFoundData> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    "FaultException<NotFoundData>" + "\n\r" +
                                    "Reason: " + ex.Message + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (FaultException ex)
                {
                    MessageBox.Show("Faultxception thrown by service.\n\rException type: " +
                                  "FaultException" + "\n\r" +
                                  "Message: " + ex.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " + ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
            }
        }
示例#6
0
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient("tcpEP");                       //Pass tcpEP or httpEP

                ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);
                if (data != null)
                {
                    lblCity.Content  = data.City;
                    lblState.Content = data.State;
                }
            }
        }
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text == "") return;

            using (GeoClient proxy = new GeoClient("httpEP"))
            {
                ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);

                if (data == null) return;

                lblCity.Content = data.City;
                lblState.Content = data.State;
            }
        }
        private void BtnGetInfo_OnClick(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != null)
            {
                var proxy = new GeoClient("httpEP");
                var data = proxy.GetZipInfo(txtZipCode.Text);
                if (data != null)
                {
                    lblCity.Content = data.City;
                    lblState.Content = data.State;
                }

                proxy.Close();
            }
        }
示例#9
0
        private void btnGetInfo_Click( object sender, RoutedEventArgs e )
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient("webEP");
                ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);
                if (data != null)
                {
                    lblCity.Content = data.City;
                    lblState.Content = data.State;
                }
                proxy.Close();

            }
        }
示例#10
0
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text == "")
            {
                return;
            }
            var proxy = new GeoClient("webEP");
            var data  = proxy.GetZipInfo(txtZipCode.Text);

            if (data != null)
            {
                lblCity.Content  = data.City;
                lblState.Content = data.State;
            }
            proxy.Close();
        }
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient("GeoLibRouter");

                ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);
                if (data != null)
                {
                    lblCity.Content  = data.City;
                    lblState.Content = data.State;
                }

                proxy.Close();
            }
        }
示例#12
0
 private void btnGetInfo_Click(object sender, RoutedEventArgs e)
 {
     if (txtZipCode.Text != "")
     {
         //GeoClient proxy = new GeoClient("tcpEP");
         string zipCode = txtZipCode.Text;
         try
         {
             ZipCodeData data = _proxy.GetZipInfo(zipCode);
             if (data != null)
             {
                 lblCity.Content  = data.City;
                 lblState.Content = data.State;
             }
         }
         catch (FaultException <ExceptionDetail> ex)
         {
             MessageBox.Show($"Exception thrown by service.\n\rException type :" +
                             $"FaultException<ExceptionDetail>\n\r" +
                             $"Message: {ex.Detail.Message}\n\r" +
                             $"Proxy state: {_proxy.State}");
         }
         catch (FaultException <ApplicationException> ex)
         {
             MessageBox.Show($"FaultException<ApplicationException> thrown by service.\n\rException type :" +
                             $"FaultException<ApplicationException>\n\r" +
                             $"Message: {ex.Detail.Message}\n\r" +
                             $"Proxy state: {_proxy.State}");
         }
         catch (FaultException ex)
         {
             MessageBox.Show($"FaultException thrown by service.\n\rException type :" +
                             $"{ex.GetType().Name}\n\r" +
                             $"Message: {ex.Message}\n\r" +
                             $"Proxy state: {_proxy.State}");
         }
         catch (Exception ex)
         {
             MessageBox.Show($"Exception thrown by service.\n\rException type :" +
                             $"{ex.GetType().Name}\n\r" +
                             $"Message: {ex.Message}\n\r" +
                             $"Proxy state: {_proxy.State}");
         }
         //proxy.Close();
     }
 }
示例#13
0
        private void buttonInfo_Click(object sender, RoutedEventArgs e)
        {
            if (textBoxInfo.Text != "")
            {
                GeoClient geoClientProxy = new GeoClient();

                ZipCodeData zipCodeData = geoClientProxy.GetZipInfo(textBoxInfo.Text);

                if (zipCodeData != null)
                {
                    lblCity.Content  = zipCodeData.City;
                    lblState.Content = zipCodeData.State;
                }

                geoClientProxy.Close();
            }
        }
        private void BtnGetInfo_OnClick(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.TxtZipCode.Text))
            {
                return;
            }

            var proxy = new GeoClient("httpEP");

            var data = proxy.GetZipInfo(this.TxtZipCode.Text);
            if (data != null)
            {
                LblCity.Content = data.City;
                LblState.Content = data.State;
            }

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

                ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);
                if (data != null)
                {
                    lblCity.Content  = data.City;
                    lblState.Content = data.State;
                }

                ((IDisposable)proxy).Dispose();
                //proxy.Close();
            }
        }
示例#16
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();
        }
示例#17
0
        private async void getZipInfoBtn_Click(object sender, RoutedEventArgs e)
        {
            if (zipCodeTxt.Text != "")
            {
                string zipCode = zipCodeTxt.Text;

                await Task.Run(() =>
                {
                    ZipCodeData data = _Proxy.GetZipInfo(zipCode);
                    if (data != null)
                    {
                        SendOrPostCallback callback = new SendOrPostCallback(arg =>
                        {
                            stateLbl.Content = data.State;
                            cityLbl.Content  = data.City;
                        });

                        _SyncContext.Send(callback, null);
                    }
                });
            }
        }
示例#18
0
        private void GetInfoBtn_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(ZipCodeTxt.Text))
            {
                return;
            }

            // As we have two endpoints for the same client
            // we need to specify a name for each one.
            // Here we are creating the communication to the service
            using (GeoClient proxy = new GeoClient("WsEp"))
            {
                ZipCodeData data = proxy.GetZipInfo(ZipCodeTxt.Text);
                if (data == null)
                {
                    return;
                }

                CityLbl.Content  = data.City;
                StateLbl.Content = data.State;
            }
        }
        private void BtnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(txtZipCode.Text))
                {
                    GeoClient proxy = new GeoClient("httpEP");

                    ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);
                    if (data != null)
                    {
                        lblCity.Content  = data.City;
                        lblState.Content = data.State;
                    }

                    proxy.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#20
0
        private async void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text == "")
            {
                txtZipCode.Text = "07035";
            }

            if (txtZipCode.Text != "")
            {
                //GeoClient proxy = new GeoClient("tcpEP");
                GeoClient proxy   = _Proxy;
                string    zipCode = txtZipCode.Text;

                try
                {
                    ZipCodeData data = await Task.Run(() => proxy.GetZipInfo(zipCode));

                    if (data != null)
                    {
                        lblCity.Content  = data.City;
                        lblState.Content = data.State;
                    }
                }
                catch (FaultException <ExceptionDetail> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\r\n" +
                                    "Detailed message: " + ex.Detail.Message + "\r\n" +
                                    "Proxy state: " + proxy.State.ToString());
                }
                catch (FaultException <NotFoundData> ex)
                {
                    MessageBox.Show("FaultException<NotFoundData> thrown by service.\n\rException type: " +
                                    ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\r\n" +
                                    "Detailed message: " + ex.Detail.Message + "\r\n" +
                                    "When: " + ex.Detail.When + "\r\n" +
                                    "User: "******"\r\n" +
                                    "Proxy state: " + proxy.State.ToString());
                }
                catch (FaultException <ApplicationException> ex)
                {
                    MessageBox.Show("FaultException<ApplicationException> thrown by service.\n\rException type: " +
                                    ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\r\n" +
                                    "Detailed message: " + ex.Detail.Message + "\r\n" +
                                    "Proxy state: " + proxy.State.ToString());
                }
                catch (FaultException ex)
                {
                    MessageBox.Show("FaultException thrown by service.\n\rException type: " +
                                    ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\r\n" +
                                    "Proxy state: " + proxy.State.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\r\n" +
                                    "Proxy state: " + proxy.State.ToString());
                }

                if (proxy != _Proxy)
                {
                    proxy.Close();
                }
            }
        }
示例#21
0
        private void getInfoBtn_Click(object sender, RoutedEventArgs e)
        {
            if (zipCodeTxt.Text != "")
            {
                try
                {
                    ZipCodeData data = _Proxy.GetZipInfo(zipCodeTxt.Text);

                    if (data != null)
                    {
                        cityLbl.Content  = data.City;
                        stateLbl.Content = data.State;
                    }
                }
                catch (FaultException <ExceptionDetail> ex)
                {
                    MessageBox.Show("FaultException<ExceptionDetail> thrown by service.\n\rException type: " +
                                    ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\n\r" +
                                    "Proxy state: " + _Proxy.State.ToString());
                }
                catch (FaultException <ApplicationException> ex)
                {
                    MessageBox.Show("FaultException<ApplicationException> thrown by service.\n\rException type: " +
                                    ex.GetType().Name + "\n\r" +
                                    "Reason: " + ex.Message + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" +
                                    "Proxy state: " + _Proxy.State.ToString());
                }
                catch (FaultException <NotFoundData> ex)
                {
                    MessageBox.Show("FaultException<NotFoundData> thrown by service.\n\rException type: " +
                                    ex.GetType().Name + "\n\r" +
                                    "Reason: " + ex.Message + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" +
                                    "Time: " + ex.Detail.When + "\n\r" +
                                    "User: "******"\n\r" +
                                    "Proxy state: " + _Proxy.State.ToString());
                }
                catch (FaultException ex)
                {
                    MessageBox.Show("FaultException thrown by service.\n\rException type: " +
                                    ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\n\r" +
                                    "Proxy state: " + _Proxy.State.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\n\r" +
                                    "Proxy state: " + _Proxy.State.ToString());
                }

                //// Instancing and concurrency
                //ZipCodeData data = _Proxy.GetZipInfo();
                //if (data != null)
                //{
                //    cityLbl.Content = data.City;
                //    stateLbl.Content = data.State;
                //}

                //// Metadata Exchange
                //ServiceReference1.GeoServiceClient proxy = new ServiceReference1.GeoServiceClient("BasicHttpBinding_IGeoService");

                //ZipCodeData data = proxy.GetZipInfo(zipCodeTxt.Text);

                //if (data != null)
                //{
                //    cityLbl.Content = data.City;
                //    stateLbl.Content = data.State;
                //}

                //GeoClient proxy = new GeoClient("tcpEP");

                //ZipCodeData data = proxy.GetZipInfo(zipCodeTxt.Text);
                //if (data != null)
                //{
                //    cityLbl.Content = data.City;
                //    stateLbl.Content = data.State;
                //}

                //proxy.Close();
            }
        }
示例#22
0
        //Old way to do with thread. From now on use the async way.
        //private void GetZipInfoCommon()
        //{
        //	string zipToSearch = txtZipSearch.Text;
        //	if (!string.IsNullOrWhiteSpace(zipToSearch))
        //	{
        //		Thread thread = new Thread(() =>
        //		{
        //			ZipCodeData data = _Proxy.GetZipInfo(zipToSearch);
        //			if (data != null)
        //			{
        //				SendOrPostCallback callback = new SendOrPostCallback(arg =>
        //				{
        //					lblResponseCity.Content = data.City;
        //					lblResponseState.Content = data.State;
        //				});

        //				_SyncContext.Send(callback, null);
        //			}
        //		})
        //		{
        //			IsBackground = true
        //		};

        //		thread.Start();
        //	}
        //}

        private async void GetZipInfoCommon()
        {
            try
            {
                string zipToSearch = txtZipSearch.Text;
                if (!string.IsNullOrWhiteSpace(zipToSearch))
                {
                    await Task.Run(() =>
                    {
                        ZipCodeData data = _Proxy.GetZipInfo(zipToSearch);
                        if (data != null)
                        {
                            SendOrPostCallback callback = new SendOrPostCallback(arg =>
                            {
                                lblResponseCity.Content  = data.City;
                                lblResponseState.Content = data.State;
                            });

                            _SyncContext.Send(callback, null);
                        }
                    });
                }
            }
            catch (FaultException <ExceptionDetail> ex)
            {
                MessageBox.Show("FaultException<ExceptionDetail> thrown by service.\n\rException Type: " +
                                "FaultException<ExceptionDetail>\n\r" +
                                "Message: " + ex.Detail.Message + "\n\r" +
                                "Proxy State: " + _Proxy.State.ToString());
            }
            catch (FaultException <ApplicationException> ex)
            {
                MessageBox.Show("FaultException<ApplicationException> thrown by service.\n\rException Type: " +
                                "FaultException<ApplicationException>\n\r" +
                                "Reason: " + ex.Message + "\n\r" +
                                "Message: " + ex.Detail.Message + "\n\r" +
                                "Proxy State: " + _Proxy.State.ToString());
            }
            catch (FaultException <NotFoundData> ex)
            {
                MessageBox.Show("FaultException<NotFoundData> thrown by service.\n\rException Type: " +
                                "FaultException<NotFoundData>\n\r" +
                                "Reason: " + ex.Message + "\n\r" +
                                "Message: " + ex.Detail.Message + "\n\r" +
                                "Proxy State: " + _Proxy.State.ToString());
            }
            catch (FaultException ex)
            {
                MessageBox.Show("FaultException thrown by service.\n\rException Type: " +
                                ex.GetType().Name + "\n\r" +
                                "Message: " + ex.Message + "\n\r" +
                                "Proxy State: " + _Proxy.State.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception thrown by service.\n\rException Type: " +
                                ex.GetType().Name + "\n\r" +
                                "Message: " + ex.Message + "\n\r" +
                                "Proxy State: " + _Proxy.State.ToString());
            }
        }