Saturday, May 4, 2019

C# > Displaying the Results of getItemAvailability Operation to the console.

Below is sample code for displaying the results of the getItemAvailability Operation to the console. Please note in order to display this code you will need to perform a successful getItemAvailablity operation and you will need a valid login session.

// Performing the GetItemAvailability operation.
GetItemAvailabilityResult giar = nss.getItemAvailability(iaf);
if (giar.status.isSuccess == true)
{
 //Casting the results to a array of type ItemAvailability
 ItemAvailability[] ib = (ItemAvailability[])giar.itemAvailabilityList;

 //Looping through the results
 foreach (var itemRS in ib)
 {
   // Creating variables and assigning the results of the operation to the variables.
   var item = (ItemAvailability)itemRS;
   Double d = item.onHandValueMli;
   Double d1 = item.preferredStockLevel;
   Double d2 = item.quantityAvailable;
   Double d3 = item.quantityBackOrdered;
   Double d4 = item.quantityCommitted;
   Double d5 = item.quantityOnHand;
   Double d6 = item.quantityOnOrder;
   Double d7 = item.reorderPoint;
   // Displaying the Results via the console.
   Console.Write("Item: " + item.item.name + "\n" +
        "Item On Hand: " + d + "\n" +
        "Item Preferred Stock level: " + d1 + "\n" +
        "Item Quantity Available: " + d2 + "\n" +
        "Item Quantity on Back Order: " + d3 + "\n" +
        "Item Quantity Committed: " + d4 + "\n" +
        "Item Quantity On Hand: " + d5 + "\n" +
        "Item Quantity On Order: " + d6 + "\n" +
        "Item Reorder Point: " + d7 + "\n" + "\n" + " ------------ " + "\n");
 }
 Console.ReadKey();
}

No comments:

Post a Comment