Example #1
0
        /// <summary>
        /// Look up a customer based on the customer ID.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lookupID_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                errormsg.Text = string.Empty;
                results       = null;
                resultsList.Items.Clear();
                id.Text = id.Text.Trim();

                results    = new CustomerWS.CustomerProviderCustomerRecord[1];
                results[0] = CustomerLookup.GetCustomerByID(id.Text);

                if (results != null)
                {
                    foreach (CustomerWS.CustomerProviderCustomerRecord record in results)
                    {
                        fillList(record);
                    }
                }
                if (resultsList.Items.Count > 0)
                {
                    resultsList.Items[0].Selected = true;
                    resultsList.Focus();
                }
                else
                {
                    errormsg.Text = localize.LOOKUP_DLG_UNABLE_CUST_ID;
                }
            }
            catch (System.ServiceModel.FaultException <System.ServiceModel.ExceptionDetail> ex)
            {
                errormsg.Text = ex.Message;
            }
            catch (System.Net.WebException wex)                // v1.02
            {
                Logging.Error(Application.ProductName, localize.DESKTOP_IIS_ERROR, wex);
            }
            catch (Exception exp)
            {
                Logging.Error(Application.ProductName, localize.LOOKUP_DLG_UNABLE_CUST_RECORD, exp.Message);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }