Udostępnij za pośrednictwem


GetShippingMethods Method (String)

Returns the list of configured shipping methods for the specified language.

Namespace:  Microsoft.CommerceServer.Runtime.Orders
Assembly:  Microsoft.CommerceServer.Runtime (in Microsoft.CommerceServer.Runtime.dll)

Syntax

'Declaration
Public Function GetShippingMethods ( _
    languageId As String _
) As DataSet
'Usage
Dim instance As OrderContext
Dim languageId As String
Dim returnValue As DataSet

returnValue = instance.GetShippingMethods(languageId)
public DataSet GetShippingMethods(
    string languageId
)
public:
DataSet^ GetShippingMethods(
    String^ languageId
)
public function GetShippingMethods(
    languageId : String
) : DataSet

Parameters

  • languageId
    Type: System..::.String
    LanguageId for language in which shipping is needed.

Return Value

Type: System.Data..::.DataSet
A DataSet containing a data table for the shipping methods that are enabled for the specified language,

Remarks

The GetShippingMethods method caches shipping methods, and returns shipping methods from the cache if the shipping method cache is configured. GetShippingMethods queries the database only when the cache is not configured.

The GetShippingMethods(String) method returns a dataset with a single table that contains one record for each Shipping Method that is configured. For each ShippingMethodId, if a Shipping Method is configured whose LanguageId value matches the value that you specify, that Shipping Method is added to the dataset that is returned. If there is no Shipping Method with a matching LanguageId value, the default Shipping Method for that ShippingMethodId is added to the dataset that is returned.

Shipping methods are stored in the database table named ShippingMethod in the transaction configuration database. The query returns the following seven columns:

  1. ShippingMethodId SQL Data Type: uniqueidentifier

  2. LanguageId SQL Data Type: nvarchar(128)

  3. ShippingMethodName SQL Data Type: nvarchar(255)

  4. Description SQL Data Type: nvarchar(255)

  5. ShippingCostCalculator SQL Data Type: nvarchar(255)

  6. ConfiguredMode SQL Data Type: int

  7. ActionPage SQL Data Type: nvarchar(255)

  8. ActionFriendlyName SQL Data Type: nvarchar(255)

For example, assume that the Shipping Methods listed in the following table have been configured for your Commerce Server Web application.

ShippingMethodId

LanguageId

ShippingMethodName

IsDefault

Enabled

SM1

en-US

SM1-enUS

True

True

SM1

fr-FR

SM1-frFR

False

True

SM2

fr-FR

SM2-frFR

True

True

SM3

en-US

SM3-enUS

True

True

SM3

de-DE

SM3-deDE

False

True

In your site code, you execute the following code:

DataSet deShippingMethods = OrderContext.Current.GetShippingMethods("de-DE");

The dataset deShippingMethods will contain one table with the following three records:

  • SM1-enUS. Because there is no Shipping Method configured with ShippingMethodId SM1 and LanguageId "de-DE", the default Shipping Method for SM1 is included.

  • SM2-frFR. Because there is no Shipping Method configured with ShippingMethodId SM2 and LanguageId "de-DE", the default Shipping Method for SM2 is included.

  • SM3-deDE. Because there is a Shipping Method configured with ShippingMethodId SM3 and LanguageId "de-DE", the Shipping Method for SM3 in language de-DE is returned, even though it is not the default.

Permissions

See Also

Reference

OrderContext Class

OrderContext Members

GetShippingMethods Overload

Microsoft.CommerceServer.Runtime.Orders Namespace