//search btn in the createupdate form is used to find the product
        //based on the upc input
        private void btnsearchupc_Click(object sender, EventArgs e)
        {
            var    client = new ProductClient();
            string result = "";

            try
            {
                long productupc = long.Parse(searchupcbox.Text);
                search_update_product = client.GetProductByUPC(productupc);

                if (search_update_product.ProductID != 0)
                {
                    var sb = new StringBuilder();
                    sb.Append("ProductID:" + search_update_product.ProductID.ToString() + "\r\n");
                    sb.Append("ProductName:" + search_update_product.ProductName + "\r\n");
                    sb.Append("ProductUPC:" + search_update_product.UPC + "\r\n");
                    sb.Append("ProductPrice:" + search_update_product.UnitPrice.ToString() + "\r\n");
                    sb.Append("Category:" + search_update_product.CategoryRefID.ToString());
                    result = sb.ToString();
                    enable_Update_Buttons();
                }
                else
                {
                    result = "No product found with that UPC";
                    disable_Update_Buttons();
                }
            }
            catch (TimeoutException ex)
            {
                result = "The service operation timed out. " +
                         ex.Message;
            }
            catch (FaultException ex)
            {
                result = "Unknown Fault: " +
                         ex.ToString();
            }
            catch (CommunicationException ex)
            {
                result = "There was a communication problem. " +
                         ex.Message + ex.StackTrace;
            }
            catch (Exception ex)
            {
                result = "Other exception: " +
                         ex.Message + ex.StackTrace;
            }
            productdetail.Text = result;
        }
        private void getproduct_Click(object sender, EventArgs e)
        {
            var    client = new ProductClient();
            string result = "";

            try
            {
                long productupc = long.Parse(upcbox.Text);
                upc_product = client.GetProductByUPC(productupc);

                var sb = new StringBuilder();
                //sb.Append("ProductID:" + product.ProductID.ToString() + "\r\n");
                sb.Append("ProductUPC:" + upc_product.UPC + "\r\n");
                sb.Append("ProductName:" + upc_product.ProductName + "\r\n");
                sb.Append("ProductPrice:" + upc_product.UnitPrice.ToString() + "\r\n");
                //sb.Append("Category:" + product.Category_Category_ID + "\r\n");
                result = sb.ToString();
            }
            catch (TimeoutException ex)
            {
                result = "The service operation timed out. " +
                         ex.Message;
            }
            catch (FaultException ex)
            {
                result = "Unknown Fault: " +
                         ex.ToString();
            }
            catch (CommunicationException ex)
            {
                result = "There was a communication problem. " +
                         ex.Message + ex.StackTrace;
            }
            catch (Exception ex)
            {
                result = "Other exception: " +
                         ex.Message + ex.StackTrace;
            }
            productbox.Text = result;
        }