Ejemplo n.º 1
0
        //QUERY ONE PRODUCT
        public VinProduct.Response1 QueryOneProduct(string sku)     //public PS_Response1 QueryOneProduct(string sku)
        {
            bool   result;
            double count;

            //variables
            sku = txtQuerySku.Text;                                //what if it is BLANK or INCORRECT?
            pc  = new ProductController(WS_USERNAME, WS_PASSWORD); //create controller (to run query)

            //response = new PS_Response1();              //create (Response) object
            //product = new PS_Product1();                //create (Product) object for results
            response = new VinProduct.Response1();              //create (Response) object
            product  = new VinProduct.Product1();               //create (Product) object for results

            //need to run query
            //***************************************
            response = pc.PS_SearchProductBySKU2(sku);
            //***************************************

            //was result successful?
            result = (bool)response.IsSuccessful;
            count  = (double)response.RecordCount;

            if (result && count > 0)      //if true
            {
                if (count == 1)           //only ONE product (make sure)
                {
                    //create a product
                    //product = response.Products[0];
                    //show results
                    //txtVin65Xml.Text = XmlController.Serialize(product);      //xml for product
                    txtVin65Xml.Text = XmlController.Serialize(response);       //xml for entire response
                }
            }
            else if (count == 0)
            {
                txtVin65Xml.Text = "There were no results found.";              //RecordCount is zero(0)
            }

            return(response);

            //product = pc.PS_SearchProductBySKU(sku);
            //product.

            //product = pc.PS_SearchProductBySKU("739242");

            //need to confirm in was successful



            //need to show results
            //txtVin65Xml.Text = XmlController.Serialize(pc.PS_SearchProductBySKU(sku));
            //XmlController.Serialize(pc2.PS_SearchAllProducts2()));
        }
Ejemplo n.º 2
0
        //TEST to query web service
        public void test()
        {
            //PS_Product1 product = new PS_Product1();
            VinProduct.Product1 product = new VinProduct.Product1();

            ProductController pc = new ProductController(WS_USERNAME, WS_PASSWORD);

            product = pc.PS_SearchProductBySKU("739242");

            txtVin65Xml.Text = product.ProductID;
        }
Ejemplo n.º 3
0
        //QUERY ALL PRODUCTS
        private VinProduct.Response1 QueryAllProducts()         //private PS_Response1 QueryAllProducts()
        {
            bool   result;
            double count;

            //variables
            pc = new ProductController(WS_USERNAME, WS_PASSWORD);               //create controller (to run query)
            //response = new PS_Response1();              //create (Response) object
            //product = new PS_Product1();                //create (Product) object for results
            response = new VinProduct.Response1();              //create (Response) object
            product  = new VinProduct.Product1();               //create (Product) object for results

            //need to run query
            //***************************************
            response = pc.PS_SearchAllProducts2();
            //***************************************

            //was result successful?
            result = (bool)response.IsSuccessful;
            count  = (double)response.RecordCount;

            if (result && count > 0)      //if true
            {
                //create a list of products
                //products = response.Products;
                //show results
                //txtVin65Xml.Text = XmlController.Serialize(products);     //xml for products
                txtVin65Xml.Text = XmlController.Serialize(response);           //xml for entire response
            }
            else if (count == 0)
            {
                txtVin65Xml.Text = "There were no results found.";              //RecordCount is zero(0)
            }

            return(response);
        }