Alguien me puede pasar este codigo a C#??

12/08/2004 - 10:40 por Jorge | Informe spam
Private Function GetCategoryByDefinition(ByVal product_id, ByVal
category_definiton_name As String, ByVal CatalogWebServiceUrl, ByVal
catalog_name) As String

'initialize the catalog
Dim cat_item As CatalogItemsDataSet.CatalogItem

Dim csa As New CatalogServiceAgent(CatalogWebServiceUrl)

Dim ctxt As CatalogContext = CatalogContext.Create(csa, New
ConsoleDebugContext(DebugMode.Checked))

Dim obj_catalog as ProductCatalog = ctxt.GetCatalog("store")

'get the product from the product_id
Dim obj_product as Product = obj_catalog.GetProduct(product_id)

'get the categories associated with the product
Dim categories As CatalogItemsDataSet.CatalogItemsDataTable obj_product.ParentCategories.CatalogItems

'loop through the categories to find the value of the category that
matches the category defition you'd like to find out if the product
belongs to.
For Each cat_item In categories

Try

'FNull tests for IsDbNull and returns an empty string,
otherwise returns value
If (FNull(cat_item.DefinitionName) = category_def) Then

Return cat_item.CategoryName

Exit Function

End If

Catch

End Try

Next
 

Leer las respuestas

#1 Oscar Onorato
12/08/2004 - 15:27 | Informe spam
Jorge, podes encontrar traductores de C# a VB.NET o viceversa en google.
En este momento no tengo un link para pasarte porque los tengo en el
trabajo. Pero hay muchas buenas páginas traductoras. Yo las encontré
buscando por:
"C# Translator"

Suerte.





"Jorge" escribió en el mensaje
news:
Private Function GetCategoryByDefinition(ByVal product_id, ByVal
category_definiton_name As String, ByVal CatalogWebServiceUrl, ByVal
catalog_name) As String

'initialize the catalog
Dim cat_item As CatalogItemsDataSet.CatalogItem

Dim csa As New CatalogServiceAgent(CatalogWebServiceUrl)

Dim ctxt As CatalogContext = CatalogContext.Create(csa, New
ConsoleDebugContext(DebugMode.Checked))

Dim obj_catalog as ProductCatalog = ctxt.GetCatalog("store")

'get the product from the product_id
Dim obj_product as Product = obj_catalog.GetProduct(product_id)

'get the categories associated with the product
Dim categories As CatalogItemsDataSet.CatalogItemsDataTable > obj_product.ParentCategories.CatalogItems

'loop through the categories to find the value of the category that
matches the category defition you'd like to find out if the product
belongs to.
For Each cat_item In categories

Try

'FNull tests for IsDbNull and returns an empty string,
otherwise returns value
If (FNull(cat_item.DefinitionName) = category_def) Then

Return cat_item.CategoryName

Exit Function

End If

Catch

End Try

Next


Preguntas similares