Commerce Server General - very very important, translate this code to C#

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > August 2004 > very very important, translate this code to C#





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author very very important, translate this code to C#
Jorge

2004-08-11, 2:49 am

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


Thanks!!!


Vinod Kumar[MSFT]

2004-08-22, 5:58 pm

Are you working on CS2K or CS2002?

This posting is provided "AS IS" with no warranties, and confers no rights.

EBusiness Server Team
--------------------
From: "Jorge" <jorge@visualpr.net>
Subject: very very important, translate this code to C#
Date: Wed, 11 Aug 2004 09:03:20 +0200
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.181
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181
Message-ID: <#hppEF3fEHA.596@TK2MSFTNGP11.phx.gbl>
Newsgroups: microsoft.public.commerceserver.general
NNTP-Posting-Host: 202.red-80-38-81.pooles.rima-tde.net 80.38.81.202
Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11
.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.commerceserver.general:14500
X-Tomcat-NG: microsoft.public.commerceserver.general

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


Thanks!!!



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com