Click or drag to resize

IWsCommonGetPurchasedCustomProducts Method

The method gets the Custom Products purchased

Namespace:  Aruba.Cloud.WsCommon
Assembly:  Aruba.Cloud.WsCommon (in Aruba.Cloud.WsCommon.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
[OperationContractAttribute]
WsResult<CustomProductsData> GetPurchasedCustomProducts()

Return Value

Type: WsResultCustomProductsData
The entity contains the list of Custom Products purchased, with the detail of each of it
Remarks
This method allows you to retrieve all Custom Products purchased in the active state and the history of changes made to it
Examples
/// IWsCommon.GetPurchasedCustomProducts Method (c# .NET)
public static string GetPurchasedCustomProducts(WsCommonClient client)
{
  //specify the account login details
  client.ClientCredentials.UserName.UserName = "ARU-0000";
  client.ClientCredentials.UserName.Password = "0123456789";

  StringBuilder stringBuilder = new StringBuilder();

  try
  {
    // call method GetPurchasedCustomProducts
    // obtaining a WsResultOfCustomProductsData item
    WsResultOfCustomProductsData result =
    client.GetPurchasedCustomProducts();

    // if the call is Success print returned values
    if (result.Success)
    {
      stringBuilder.Append("Operation ends successfully\n");

      // get Value returned from server
      CustomProductsData items = result.Value;

      if (items.CustomProducts != null)
      {
        // category id for monitoring products
        int monitoringCategory = 4;

        // query for the productId
        var query = from CustomProduct product in items.CustomProducts
        where product.ProductCategory.CustomProductCategoryID == monitoringCategory
        select product;

        // for each item print the information
        foreach (CustomProduct item in query)
        {
          stringBuilder.Append("\nProductID: ");
          stringBuilder.Append(item.ProductID);
          stringBuilder.Append("\nCustomProductID: ");
          stringBuilder.Append(item.CustomProductID);
          stringBuilder.Append("\nName: ");
          stringBuilder.Append(item.ProductName);
          stringBuilder.Append("\nQuantity: ");
          stringBuilder.Append(item.Quantity);
          stringBuilder.Append("\nDescription: ");
          stringBuilder.Append(item.ProductDescription);
          stringBuilder.Append("\ncategory id: ");
          stringBuilder.Append(item.ProductCategory.CustomProductCategoryID);
          stringBuilder.Append("\ncategory description: ");
          stringBuilder.Append(item.ProductCategory.Description);

        }
      }
    }
    else
    {
      throw new ApplicationException(result.ResultMessage);
    }
  }
  catch (Exception ex)
  {
    // re-run the error
    throw new ApplicationException(ex.Message);
  }

  return stringBuilder.ToString();
}
See Also