//------ //CONSTRUCTOR public InventoryController(string username, string password) { //INSTANTIATE OBJECTS conn = new MyConnection(username, password); //Establish a connection when an object is created iss = new VinInventory.InventoryServiceService(); //create INVENTORY SERVICES object //-------------- //SEARCH INVENTORY iss_request2 = new VinInventory.Request2(); //create REQUEST object iss_request2.Security = new VinInventory.Security(); //Security settings for connection (to VIN65 web service) iss_response2 = new VinInventory.Response2(); //create RESPONSE object (array of Products[...]) //SET USERNAME and PASSWORD iss_request2.Security.Username = conn.Ws_Username; //set global username //ps_request.Security.Username = "******"; iss_request2.Security.Password = conn.Ws_Password; //set global password //ps_request.Security.Password = "******"; //-------------- //-------------- //UPDATE INVENTORY iss_request1 = new VinInventory.Request1(); //create REQUEST object iss_request1.Security = new VinInventory.Security(); //Security settings for connection (to VIN65 web service) iss_response1 = new VinInventory.Response1(); //create RESPONSE object (array of Products[...]) //SET USERNAME and PASSWORD iss_request1.Security.Username = conn.Ws_Username; //set global username //ps_request.Security.Username = "******"; iss_request1.Security.Password = conn.Ws_Password; //set global password //ps_request.Security.Password = "******"; //-------------- }
public static void TestAddUpdateInventory1() { InventoryController iss = new InventoryController(WS_USERNAME, WS_PASSWORD); //get a inventory object (before modifying...) VinInventory.Response2 iss_response2 = new VinInventory.Response2(); iss_response2 = iss.IS_SearchInventoryBySKU2("746969c"); //make a change if ((bool)iss_response2.IsSuccessful) { if (iss_response2.RecordCount == 1) { //CHANGE THE VALUE HERE... double?inventoryCount = 23d; iss_response2.Inventory[0].CurrentInventory = inventoryCount; } //for (int i = 0; i < iss_response2.Inventory.Length; i++) //{ // //CHANGE THE VALUE HERE... // double? inventoryCount = 999d; // iss_response2.Inventory[i].CurrentInventory = inventoryCount; //} } //update the inventory VinInventory.Response1 iss_response1 = new VinInventory.Response1(); //***************************************************************** iss_response1 = iss.IS_UpdateInventory(iss_response2.Inventory[0]); //***************************************************************** //print if was success Console.WriteLine("The INVENTORY update for {0} was a success: {1}", iss_response2.Inventory[0].SKU, iss_response1.IsSuccessful); }
public static void TestAddUpdateInventory2() { InventoryController iss = new InventoryController(WS_USERNAME, WS_PASSWORD); string sku = "746969c"; double currentInventory = 44d; //request object //... //response object VinInventory.Response1 iss_response1 = new VinInventory.Response1(); //***************************************************************** iss_response1 = iss.IS_AddUpdateInventoryCountBySKU(sku, currentInventory); //***************************************************************** //print if was success Console.WriteLine("The INVENTORY update for <sku> was a success: {0}", iss_response1.IsSuccessful); }
public static void TestAddUpdateInventory3() { InventoryController iss = new InventoryController(WS_USERNAME, WS_PASSWORD); //request object //... //response object VinInventory.Response1 iss_response1a = new VinInventory.Response1(); VinInventory.Response1 iss_response1b = new VinInventory.Response1(); //***************************************************************** iss_response1a = iss.IS_AddUpdateInventoryCountBySKU("746969b", 23d); iss_response1b = iss.IS_AddUpdateInventoryCountBySKU("746969c", 33d); //***************************************************************** //print if was success Console.WriteLine("The INVENTORY update for 746969b was a success: {0}", iss_response1a.IsSuccessful); Console.WriteLine("The INVENTORY update for 746969c was a success: {0}", iss_response1b.IsSuccessful); }