Пример #1
0
        public static void TestGetProductDetails2()
        {
            ProductController pc = new ProductController(WS_USERNAME, WS_PASSWORD);

            VinProduct.Response3 ps_response3 = new VinProduct.Response3();
            ps_response3 = pc.PS_GetProductDetailsBySKU2("746969c");

            Console.WriteLine("------");
            Console.WriteLine("PRODUCT");
            //dump (is success, errors, record count)
            Utility.Utility.DumpProperties(ps_response3);
            //Utility.Utility.DumpProperties2(ps_response3);
            Console.WriteLine("   ---");
            //dump product properties
            Utility.Utility.DumpProperties(ps_response3.Product);
            Console.WriteLine("------");
        }
Пример #2
0
        public static void TestAddUpdateProduct1()
        {
            ProductController pc = new ProductController(WS_USERNAME, WS_PASSWORD);

            //get a product (before modifying...)
            VinProduct.Response3 ps_response3 = new VinProduct.Response3();
            ps_response3 = pc.PS_GetProductDetailsBySKU2("746969c");

            //make a change
            if ((bool)ps_response3.IsSuccessful)
            {
                ps_response3.Product.Title = "666 Crimes Shiraz Durif Red Blend";       //reset
                //ps_response3.Product.Title += "testtesttest";
            }

            //update the product
            pc.PS_AddUpdateProduct(ps_response3.Product);
            //Console.WriteLine("Product {0} updated...", ps_response3.Product.SKUs.)
        }
        //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
            //-----------------------------
        }