Example #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()));
        }
Example #2
0
        //EVENT (Query tab) BUTTON RUN QUERY (to VIN65 web services)
        private void btnQuery_Click(object sender, RoutedEventArgs e)
        {
            //PS_Response1 response = new PS_Response1();
            VinProduct.Response1 response = new VinProduct.Response1();

            //query one product
            if ((bool)radQueryProductSku.IsChecked)
            {
                //IsQuerySuccessDisplay(QueryOneProduct(txtQuerySku.Text));
                IsQuerySuccessDisplay(QueryOneProduct(txtQuerySku.Text));
            }
            else if ((bool)radQueryProductAll.IsChecked)
            {
                IsQuerySuccessDisplay(QueryAllProducts());
            }
        }
Example #3
0
        //QUERY SUCCESSFUL
        private void IsQuerySuccessDisplay(VinProduct.Response1 response)       //private void IsQuerySuccessDisplay(PS_Response1 response)
        {
            bool   isSuccessful = (bool)response.IsSuccessful;
            double count        = (double)response.RecordCount;

            if (isSuccessful && count > 0)
            {
                //show successful
                txtQuerySuccess.Text       = "         Query Successful         ";
                txtQuerySuccess.Visibility = Visibility.Visible;
                txtQuerySuccess.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00B21C"));   //green
            }
            else
            {
                //show NOT successful
                txtQuerySuccess.Text       = "       Query NOT Successful       ";
                txtQuerySuccess.Visibility = Visibility.Visible;
                txtQuerySuccess.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF1D4F"));   //red
            }
        }
        //CONSTRUCTOR
        public ProductController(string username, string password)
        {
            //INSTANTIATE OBJECTS
            conn = new MyConnection(username, password);    //Establish a connection when an object is created
            ps   = new VinProduct.ProductServiceService();  //create PRODUCT SERVICES object

            //--------------
            //SEARCH PRODUCT
            ps_request1          = new VinProduct.Request1();        //create REQUEST object
            ps_request1.Security = new VinProduct.Security();        //Security settings for connection (to VIN65 web service)
            ps_response1         = new VinProduct.Response1();       //create RESPONSE object (array of Products[...])

            //SET USERNAME and PASSWORD
            ps_request1.Security.Username = conn.Ws_Username;        //set global username
            //ps_request.Security.Username = "******";
            ps_request1.Security.Password = conn.Ws_Password;        //set global password
            //ps_request.Security.Password = "******";
            //--------------

            //-------------------
            //GET PRODUCT DETAILS
            ps_request3          = new VinProduct.Request3();        //create REQUEST object
            ps_request3.Security = new VinProduct.Security();        //Security settings for connection (to VIN65 web service)
            ps_response3         = new VinProduct.Response3();       //create RESPONSE object (array of Products[...])

            //SET USERNAME and PASSWORD
            ps_request3.Security.Username = conn.Ws_Username;        //set global username
            ps_request3.Security.Password = conn.Ws_Password;        //set global password
            //-------------------

            //-----------------------------
            //ADD OR UPDATE PRODUCT DETAILS
            ps_request2          = new VinProduct.Request2();        //create REQUEST object
            ps_request2.Security = new VinProduct.Security();        //Security settings for connection (to VIN65 web service)
            ps_response2         = new VinProduct.Response2();       //create RESPONSE object (array of Products[...])

            //SET USERNAME and PASSWORD
            ps_request2.Security.Username = conn.Ws_Username;        //set global username
            ps_request2.Security.Password = conn.Ws_Password;        //set global password
            //-----------------------------
        }
Example #5
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);
        }