Imports WebServicesGP2010.ServiceReference1
Imports System.ServiceModel
Imports System.Xml
Public Class GetIVPricing
Public Sub GetIVPricing()
Dim strError As String
Try
'these would normally be passed in
Dim strItemNumber As String = "WIRE-MCD-0001"
Dim strPriceLevel As String = "RETAIL"
Dim strUofM = "Foot"
'================================================================
'common code
'================================================================
Dim companyKey As CompanyKey
Dim context As Context
Dim pricingKey As New PricingKey
Dim pricing As Pricing
' Create an instance of the service
Dim wsDynamicsGP As DynamicsGPClient = New DynamicsGPClient
' Create a context with which to call the service
context = New Context
' Specify which company to use (sample company)
companyKey = New CompanyKey
companyKey.Id = -1
' Set up the context object
context.OrganizationKey = CType(companyKey, OrganizationKey)
'================================================================
'
'================================================================
'Create a pricing key to specify the pricing object
pricingKey.ItemKey = New ItemKey
pricingKey.ItemKey.Id = strItemNumber
pricingKey.PriceLevelKey = New PriceLevelKey
pricingKey.PriceLevelKey.Id = strPriceLevel
pricingKey.CurrencyKey = New CurrencyKey
pricingKey.CurrencyKey.ISOCode = "USD"
pricingKey.UofM = strUofM
'Get the specified pricing object
pricing = wsDynamicsGP.GetPricingByKey(pricingKey, context)
Dim UOMPRICE As Double = pricing.Details(0).UofMPrice.Item.value
Debug.Write(UOMPRICE)
Catch ex As System.ServiceModel.FaultException
strError = ex.Message
Catch ex As Exception
strError = ex.Message
End Try
End Sub
End Class