Microsoft KB Archive/910309

= The source code for the Commerce Server 2002 SDK ASP.NET-based Catalog Sitelet in Visual Basic .NET =

Article ID: 910309

Article Last Modified on 3/16/2007

-

APPLIES TO


 * Microsoft Commerce Server 2002 Standard Edition
 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition

-





INTRODUCTION
This article contains the source code for the Microsoft Commerce Server 2002 Software Development Kit (SDK) Microsoft ASP.NET-based Catalog Sitelet in Microsoft Visual Basic .NET.

Note The source code for the ASP.NET-based Catalog Sitelet was previously only available in Microsoft Visual C#.



MORE INFORMATION
The following code is the source code for the ASP.NET-based Catalog Sitelet in Visual Basic .NET.

Browse.aspx
<%@ Page Description=&quot;Browse Page&quot; CodePage=&quot;65001&quot; Debug=&quot;true&quot;%> <%@Import Namespace=&quot;System.Data&quot;%> <%@Import Namespace=&quot;System.Globalization&quot;%> <%@Import Namespace=&quot;System.Resources&quot;%> <%@Import Namespace=&quot;System.Threading&quot;%> <%@Import Namespace=&quot;catalogsitelet&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Catalog&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Configuration&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Diagnostics&quot;%> <%@Register TagPrefix=&quot;Localized&quot; TagName=&quot;Footer&quot; src=&quot;footer.ascx&quot; %>

        Private rm As ResourceManager Private strLanguage As String = Nothing Private catDisplayName As String = Nothing Sub Page_Init(ByVal sender As Object, ByVal args As EventArgs) rm = ResourceFactory.RManager If rm Is Nothing Then 'Resources are unavailable.Server.Transfer(Utility.errorPage) End If            End Sub

Sub Page_Load(ByVal sender As Object, ByVal args As EventArgs) Dim SelectedCulture As CultureInfo Dim coll As NameValueCollection = Request.QueryString strLanguage = coll(Utility.languageLabel)

Try SelectedCulture = CultureInfo.CreateSpecificCulture(strLanguage) Catch e As Exception SelectedCulture = CultureInfo.CreateSpecificCulture(Utility.englishLanguage) strLanguage = Utility.englishLanguage End Try Footer.Language = strLanguage

' If another culture was selected, use that instead If Not (SelectedCulture Is Nothing) Then Thread.CurrentThread.CurrentCulture = SelectedCulture Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture End If

catDisplayName = Utility.GetDisplayName(Utility.catalogName, strLanguage)

If Not IsPostBack Then UpdateCategories End If            End Sub

Sub RootCategoryListing_ItemCommand(ByVal source As Object, ByVal args As RepeaterCommandEventArgs) Dim strArg As String = CType(args.CommandArgument, String) Dim arr As String = strArg.Split(&quot;&&quot;C) Dim category As String = arr(0) Dim dispCategory As String = arr(1) Dim products As DataSet = Nothing Dim categories As DataSet = Nothing

'Get child category and products for given category GetProductListing(category, products, categories)

If Not (0 = products.Tables(0).Rows.Count) Then 'List child products for category ProductListing.DataSource = products ProductListing.DataBind ProdName.Visible = True ProductListing.Visible = True ProdName.Text = rm.GetString(Utility.browseProdCategories) & &quot; &quot; & dispCategory Else ProdName.Visible = False ProdName.Text = Nothing ProductListing.Visible = False End If

If Not (0 = categories.Tables(0).Rows.Count) Then 'List child category for parent category CategoryListing.DataSource = categories CategoryListing.DataBind CatName.Visible = True CategoryListing.Visible = True CatName.Text = rm.GetString(Utility.browseChildCategories) & &quot; &quot; & dispCategory Seprator.InnerHtml = &quot;&quot; Else CatName.Visible = False CatName.Text = Nothing CategoryListing.Visible = False Seprator.InnerHtml = Nothing End If            End Sub

Sub UpdateCategories Dim catalog As ProductCatalog = CommerceContext.Current.CatalogSystem.GetCatalog(Utility.catalogName) RootCategoryListing.DataSource = catalog.GetRootCategories RootCategoryListing.DataBind End Sub

Sub ProductListing_ItemCommand(ByVal source As Object, ByVal args As RepeaterCommandEventArgs) Response.Redirect(rm.GetString(Utility.productPageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & strLanguage & &quot;&&quot; & Utility.productID & &quot;=&quot; & CType(args.CommandArgument, String)) End Sub

Sub GetProductListing(ByVal category As String, ByRef product As DataSet, ByRef categories As DataSet) Dim catalog As ProductCatalog = CommerceContext.Current.CatalogSystem.GetCatalog(Utility.catalogName) product = catalog.GetCategory(category).GetProducts categories = catalog.GetCategory(category).GetChildCategories End Sub <%=rm.GetString(Utility.browsePageTitle) &&quot; &quot;& catDisplayName%>    <%= rm.GetString(Utility.browsePageTitle) &&quot; &quot;& catDisplayName%>  <BR> <BR> <form id=&quot;browse&quot; method=&quot;post&quot; runat=&quot;server&quot;> <Localized:Footer runat=&quot;server&quot; ID=&quot;Footer&quot; /> </HTML>

Default.aspx
<%@Page Description=&quot;Default Page&quot; CodePage=&quot;65001&quot; %> <%@Import Namespace=&quot;catalogsitelet&quot;%> <%@Import Namespace=&quot;System.Threading&quot;%> <%@Import Namespace=&quot;System.Resources&quot;%> <%@Import Namespace=&quot;System.Globalization&quot;%>

<HTML>  <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;> <meta name=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 7.0&quot;> <meta name=&quot;CODE_LANGUAGE&quot; Content=&quot;VB&quot;> <meta name=&quot;vs_defaultClientScript&quot; content=&quot;JavaScript (ECMAScript)&quot;> <meta name=&quot;vs_targetSchema&quot; content=&quot;http://schemas.microsoft.com/intellisense/ie5&quot;> <script runat=&quot;Server&quot; Language=&quot;VB&quot;> Private rm As ResourceManager

Sub Page_Init(ByVal sender As Object, ByVal args As EventArgs) 'Get the ResourceManager from the Application object rm = ResourceFactory.RManager If rm Is Nothing Then 'Resources are unavailable Server.Transfer(Utility.errorPage) End If            End Sub

Sub Page_Load(ByVal sender As Object, ByVal args As EventArgs) Try Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages(0)) Catch generatedExceptionVariable0 As Exception 'Provide fallback for not supported languages Thread.CurrentThread.CurrentCulture = New CultureInfo(Utility.englishLanguage) End Try Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture If Not IsPostBack Then English.Text = rm.GetString(Utility.English) German.Text = rm.GetString(Utility.German) French.Text = rm.GetString(Utility.French) Japanese.Text = rm.GetString(Utility.Japanese) English.NavigateUrl = rm.GetString(Utility.mainPageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & Utility.englishLanguage German.NavigateUrl = rm.GetString(Utility.mainPageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & Utility.germanLanguage French.NavigateUrl = rm.GetString(Utility.mainPageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & Utility.frenchLanguage Japanese.NavigateUrl = rm.GetString(Utility.mainPageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & Utility.japaneseLanguage End If            End Sub <%=rm.GetString(Utility.siteletTitle)%> <LINK REL=&quot;stylesheet&quot; TYPE=&quot;text/css&quot; HREF=&quot;sitelet.css&quot;> </HEAD> <body MS_POSITIONING=&quot;GridLayout&quot;>  <%= rm.GetString(Utility.siteletTitle)%> </DIV> <BR>  <%= rm.GetString(Utility.siteletSubTitle)%> </DIV> <BR> <form id=&quot;Languages&quot; method=&quot;post&quot; runat=&quot;server&quot;> <UL> <LI> <asp:Hyperlink id=&quot;English&quot; Text=&quot;English&quot; runat=&quot;server&quot; /> </LI> <LI> <asp:Hyperlink id=&quot;German&quot; Text=&quot;German&quot; runat=&quot;server&quot; /> </LI> <LI> <asp:Hyperlink id=&quot;French&quot; Text=&quot;French&quot; runat=&quot;server&quot; /> </LI> <LI> <asp:Hyperlink id=&quot;Japanese&quot; Text=&quot;Japanese&quot; runat=&quot;server&quot; /> </LI> </UL> </HTML>

Footer.ascx
<%@Import Namespace=&quot;System.Globalization&quot;%> <%@Import Namespace=&quot;System.Resources&quot;%> <%@Import Namespace=&quot;catalogsitelet&quot; %> <%@ Control %>

<script runat=&quot;server&quot; language=&quot;VB&quot;>

Private strLanguage As String = Nothing

Protected Overloads Overrides Sub Render(ByVal writer As HtmlTextWriter) Dim rmgr As ResourceManager = ResourceFactory.RManager If Nothing = strLanguage OrElse &quot;&quot; = strLanguage.Trim Then strLanguage = Utility.englishLanguage End If

Home.Text = rmgr.GetString(&quot;L_HTMLURLText_Home&quot;) Browse.Text = rmgr.GetString(&quot;L_HTMLURLText_Footer_Browse&quot;) FTSearch.Text = rmgr.GetString(&quot;L_HTMLURLText_Footer_FTSearch&quot;) PropSearch.Text = rmgr.GetString(&quot;L_HTMLURLText_Footer_PropSearch&quot;) Home.NavigateUrl = rmgr.GetString(Utility.homePageUrl) Browse.NavigateUrl = rmgr.GetString(Utility.browsePageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & strLanguage FTSearch.NavigateUrl = rmgr.GetString(Utility.ftSearchPageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & strLanguage PropSearch.NavigateUrl = rmgr.GetString(Utility.propSearchPageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & strLanguage MyBase.Render(writer) End Sub

Public Property Language As String Get Return strLanguage End Get Set strLanguage = value End Set End Property <asp:Panel runat=&quot;server&quot;> <BR> <asp:Hyperlink id=&quot;Home&quot; Text=&quot;Home&quot; runat=&quot;server&quot; /> |   <asp:Hyperlink id=&quot;Browse&quot; Text=&quot;Browse&quot; runat=&quot;server&quot; /> |   <asp:Hyperlink id=&quot;FTSearch&quot; Text=&quot;Full Text Search&quot; runat=&quot;server&quot; /> |   <asp:Hyperlink id=&quot;PropSearch&quot; Text=&quot;Property Search&quot; runat=&quot;server&quot; /> </asp:Panel>

Ftsearch.aspx
<%@ Page Description=&quot;Localized Page&quot; CodePage=&quot;65001&quot; %> <%@Import Namespace=&quot;System.Globalization&quot;%> <%@Import Namespace=&quot;System.Resources&quot;%> <%@Import Namespace=&quot;System.Threading&quot;%> <%@Import Namespace=&quot;System.Data&quot;%> <%@Import Namespace=&quot;catalogsitelet&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Catalog&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Configuration&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Diagnostics&quot;%> <%@Register TagPrefix=&quot;Localized&quot; TagName=&quot;Footer&quot; src=&quot;footer.ascx&quot; %>

<HTML>  <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;> <meta name=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 7.0&quot;> <meta name=&quot;CODE_LANGUAGE&quot; Content=&quot;VB&quot;> <meta name=&quot;vs_defaultClientScript&quot; content=&quot;JavaScript (ECMAScript)&quot;> <meta name=&quot;vs_targetSchema&quot; content=&quot;http://schemas.microsoft.com/intellisense/ie5&quot;> <script runat=&quot;Server&quot; Language=&quot;VB&quot;> Private rm As ResourceManager Private strLanguage As String = Nothing Private catDisplayName As String = Nothing Private searchText As String = Nothing

Sub Page_Init(ByVal sender As Object, ByVal args As EventArgs) 'Get the ResourceManager from the Application object rm = ResourceFactory.RManager If rm Is Nothing Then 'Resources are unavailable Server.Transfer(Utility.errorPage) End If            End Sub

Sub Page_Load(ByVal sender As Object, ByVal args As EventArgs) Dim SelectedCulture As CultureInfo Dim coll As NameValueCollection = Request.QueryString strLanguage = coll(Utility.languageLabel) Try SelectedCulture = CultureInfo.CreateSpecificCulture(strLanguage) Catch e As Exception 'Fallback to English language SelectedCulture = CultureInfo.CreateSpecificCulture(Utility.englishLanguage) strLanguage = Utility.englishLanguage End Try 'Set Language on footer control Footer.Language = strLanguage 'Set culture for current thread If Not (SelectedCulture Is Nothing) Then Thread.CurrentThread.CurrentCulture = SelectedCulture Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture End If                'Initialize controls with appropriate texts Search.Text = rm.GetString(Utility.ftSearchSearch)

'Get display name for catalog, write a function catDisplayName = Utility.GetDisplayName(Utility.catalogName, strLanguage) End Sub

Sub SearchButton_Click(ByVal sender As Object, ByVal args As EventArgs) Try Dim totalRecords As Integer = 0 Dim startPage As Integer = 1 searchText = txtSearchText.Text If searchText.Trim = &quot;&quot; Then Return End If                    Dim catalogCtx As CatalogContext = CommerceContext.Current.CatalogSystem Dim searchResult As DataSet = FreeTextSearch(searchText, startPage, totalRecords) If 0 < searchResult.Tables(0).Rows.Count Then rptSearchResult.Visible = True rptSearchResult.DataSource = searchResult rptSearchResult.DataBind Matches.Text = totalRecords.ToString & &quot; &quot; & rm.GetString(Utility.ftSearchTotal) Else rptSearchResult.Visible = False Seprator.InnerHtml = Nothing Pages.Text = Nothing Matches.Text = Nothing End If                    'Do paging Paging.Visible = False If totalRecords > Utility.numberOfRecordToDisplay Then Dim pagingTable As DataTable = Utility.DoPaging(totalRecords, Utility.numberOfRecordToDisplay, searchText) Paging.DataSource = pagingTable.DefaultView Paging.DataBind Paging.Visible = True Seprator.InnerHtml = &quot;<BR>&quot; Pages.Text = rm.GetString(Utility.ftSearchPage) End If                Catch e As Exception 'Eat exception End Try End Sub

'Page click response Sub PageClick_ItemCommand(ByVal sender As Object, ByVal args As RepeaterCommandEventArgs) Dim searchClause As String = CType(args.CommandArgument, String) Dim totalRecords As Integer = 0 Dim page As Integer = args.Item.ItemIndex + 1 Dim searchResult As DataSet = FreeTextSearch(searchText, page, totalRecords) 'If products found If 0 < searchResult.Tables(0).Rows.Count Then rptSearchResult.Visible = True rptSearchResult.DataSource = searchResult rptSearchResult.DataBind Seprator.InnerHtml = &quot;<BR>&quot; Pages.Text = rm.GetString(Utility.ftSearchPage) Matches.Text = totalRecords.ToString & &quot; &quot; & rm.GetString(Utility.ftSearchTotal) Else rptSearchResult.Visible = False Seprator.InnerHtml = Nothing Pages.Text = Nothing End If            End Sub

Function FreeTextSearch(ByVal searchstring As String, ByVal page As Integer, ByRef totalRecords As Integer) As DataSet 'Search Options Dim searchOptions As CatalogSearchOptions = Utility.SetSearchOptions(page, Utility.numberOfRecordToDisplay, &quot;name&quot;) 'Look for the products supporting search criteria Dim search As CatalogSearch = New CatalogSearch(CommerceContext.Current.CatalogSystem) search.CatalogNames = Utility.catalogName search.FreeTextSearchPhrase = searchstring search.SearchOptions = searchOptions Return search.Search(totalRecords) End Function

Sub ProductListing_ItemCommand(ByVal sender As Object, ByVal args As RepeaterCommandEventArgs) Response.Redirect(rm.GetString(Utility.productPageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & strLanguage & &quot;&&quot; & Utility.productID & &quot;=&quot; & CType(args.CommandArgument, String)) End Sub <%=rm.GetString(Utility.ftPageTitle) & &quot; &quot; & catDisplayName%> <LINK REL=&quot;stylesheet&quot; TYPE=&quot;text/css&quot; HREF=&quot;sitelet.css&quot;> </HEAD>  <%= rm.GetString(Utility.ftPageTitle) & &quot; &quot; & catDisplayName%> </DIV> <form id=&quot;ftsearch&quot; method=&quot;post&quot; runat=&quot;server&quot;> <asp:TextBox id=&quot;txtSearchText&quot; runat=&quot;server&quot;></asp:TextBox> <input type=text style=&quot;visibility:hidden&quot; runat=&quot;server&quot;/> <BR> <asp:Button id=&quot;Search&quot; runat=&quot;server&quot; Text=&quot;Search&quot; OnClick=&quot;SearchButton_Click&quot;></asp:Button> <asp:Label id=&quot;Matches&quot; runat=&quot;server&quot; /> <asp:Repeater id=&quot;rptSearchResult&quot; OnItemCommand=&quot;ProductListing_ItemCommand&quot; runat=&quot;server&quot;> <ItemTemplate> <asp:LinkButton id=&quot;SelectProductBtn&quot; CommandName=&quot;Select&quot; CommandArgument='<%# CType(Container.DataItem, DataRowView)(&quot;ProductID&quot;) %>' runat=&quot;server&quot;> <%# DataBinder.Eval(Container.DataItem, &quot;Name&quot;) %> </asp:LinkButton> (                   <asp:Label id=&quot;Describe&quot; runat=&quot;server&quot;>                        <%# DataBinder.Eval(Container.DataItem, &quot;description&quot;) %>                    </asp:Label>                    ) </ItemTemplate> <SeparatorTemplate> <BR> </SeparatorTemplate> </asp:Repeater>  <asp:Label id=&quot;Pages&quot; runat=&quot;server&quot; /> <asp:Repeater id=&quot;Paging&quot; OnItemCommand=&quot;PageClick_ItemCommand&quot; runat=&quot;server&quot;> <ItemTemplate> <asp:LinkButton id=&quot;PageClick&quot; CommandName=&quot;Select&quot; CommandArgument='<%# CType(Container.DataItem, DataRowView)(&quot;Clause&quot;) %>' runat=&quot;server&quot;> <%# DataBinder.Eval(Container.DataItem, &quot;Page&quot;) %> </asp:LinkButton> </ItemTemplate> </asp:Repeater> <Localized:Footer runat=&quot;server&quot; id=&quot;Footer&quot; /> </HTML>

Global.ascx
<%@Import namespace=&quot;System&quot;%> <%@Import namespace=&quot;System.Collections&quot;%> <%@Import namespace=&quot;System.ComponentModel&quot;%> <%@Import namespace=&quot;System.Web&quot;%> <%@Import namespace=&quot;System.Web.SessionState&quot;%> <%@Import namespace=&quot;Microsoft.CommerceServer.Runtime&quot;%> <%@Import namespace=&quot;System.IO&quot;%> <%@Import namespace=&quot;System.Resources&quot;%> <%@Import namespace=&quot;System.Threading&quot;%> <%@Import namespace=&quot;System.Globalization&quot;%>

<script runat=&quot;server&quot; language=&quot;VB&quot;>

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) End Sub

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) End Sub

Sub Application_EndRequest(ByVal sender As Object, ByVal e As EventArgs) End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) End Sub

Sub InitializeComponent End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) End Sub

Main.aspx
<%@Page Description=&quot;Localized Page&quot; CodePage=&quot;65001&quot; %> <%@Import Namespace=&quot;catalogsitelet&quot;%> <%@Import Namespace=&quot;System.Resources&quot;%> <%@Import Namespace=&quot;System.Threading&quot;%> <%@Import Namespace=&quot;System.Globalization&quot;%> <%@Import Namespace=&quot;System.Data&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Catalog&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Configuration&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Diagnostics&quot;%> <%@Register TagPrefix=&quot;Localized&quot; TagName=&quot;Footer&quot; src=&quot;footer.ascx&quot; %>

<HTML>  <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;> <meta name=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 7.0&quot;> <meta name=&quot;CODE_LANGUAGE&quot; Content=&quot;VB&quot;> <meta name=&quot;vs_defaultClientScript&quot; content=&quot;JavaScript (ECMAScript)&quot;> <meta name=&quot;vs_targetSchema&quot; content=&quot;http://schemas.microsoft.com/intellisense/ie5&quot;> <script runat=&quot;Server&quot; Language=&quot;VB&quot;> Private rm As ResourceManager Private strLanguage As String = Nothing

Sub Page_Init(ByVal sender As Object, ByVal args As EventArgs) 'Get the ResourceManager from the Application object rm = ResourceFactory.RManager If rm Is Nothing Then 'Resources are unavailable Server.Transfer(Utility.errorPage) End If            End Sub

Sub Page_Load(ByVal sender As Object, ByVal args As EventArgs) Dim SelectedCulture As CultureInfo Dim coll As NameValueCollection = Request.QueryString strLanguage = coll(Utility.languageLabel) Try SelectedCulture = CultureInfo.CreateSpecificCulture(strLanguage) Catch e As Exception SelectedCulture = CultureInfo.CreateSpecificCulture(Utility.englishLanguage) strLanguage = Utility.englishLanguage End Try Footer.Language = strLanguage If Not (SelectedCulture Is Nothing) Then Thread.CurrentThread.CurrentCulture = SelectedCulture Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture End If                If Not IsPostBack Then BrowseCat.Text = rm.GetString(Utility.browsePageLabel) FullTextSearch.Text = rm.GetString(Utility.ftSearchLabel) PropertySearch.Text = rm.GetString(Utility.propSearchLabel) BrowseCat.NavigateUrl = rm.GetString(Utility.browsePageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & strLanguage FullTextSearch.NavigateUrl = rm.GetString(Utility.ftSearchPageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & strLanguage PropertySearch.NavigateUrl = rm.GetString(Utility.propSearchPageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & strLanguage End If            End Sub <%=rm.GetString(Utility.pageTitle)%> <LINK REL=&quot;stylesheet&quot; TYPE=&quot;text/css&quot; HREF=&quot;sitelet.css&quot;> </HEAD>  <%= rm.GetString(Utility.pageTitle)%> </DIV> <BR> <BR> <form id=&quot;main&quot; method=&quot;post&quot; runat=&quot;server&quot;> <ul> <li> <asp:Hyperlink id=&quot;BrowseCat&quot; Text=&quot;Browse the Catalog&quot; runat=&quot;server&quot; /> </li> <li> <asp:Hyperlink id=&quot;FullTextSearch&quot; Text=&quot;Perform a Full Text Search&quot; runat=&quot;server&quot; /> </li> <li> <asp:Hyperlink id=&quot;PropertySearch&quot; Text=&quot;Perform a Property Search&quot; runat=&quot;server&quot; /> </li> </ul> <Localized:Footer runat=&quot;Server&quot; ID=&quot;Footer&quot; /> </HTML>

Noresource.aspx
<%@ Page %>

Server Error Server Error

Localized resources were not available. Please contact the administrator.

Product.aspx
<%@ Page Description=&quot;Localized Page&quot; CodePage=&quot;65001&quot; %> <%@Import Namespace=&quot;System.Globalization&quot;%> <%@Import Namespace=&quot;System.Resources&quot;%> <%@Import Namespace=&quot;System.Threading&quot;%> <%@Import Namespace=&quot;System&quot;%> <%@Import Namespace=&quot;catalogsitelet&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Catalog&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Configuration&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Diagnostics&quot;%> <%@Import Namespace=&quot;System.Data&quot;%> <%@Register TagPrefix=&quot;Localized&quot; TagName=&quot;Footer&quot; src=&quot;footer.ascx&quot; %>

<HTML>  <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;> <meta name=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 7.0&quot;> <meta name=&quot;CODE_LANGUAGE&quot; Content=&quot;VB&quot;> <meta name=&quot;vs_defaultClientScript&quot; content=&quot;JavaScript (ECMAScript)&quot;> <meta name=&quot;vs_targetSchema&quot; content=&quot;http://schemas.microsoft.com/intellisense/ie5&quot;> <script runat=&quot;Server&quot; Language=&quot;VB&quot;> Private rm As ResourceManager Private strLanguage As String = Nothing Private catalog As ProductCatalog = Nothing Private productdt As DataRow = Nothing Private productDisplayName As String = Nothing

Sub Page_Init(ByVal sender As Object, ByVal args As EventArgs) 'ResourceManager from the Application object rm = ResourceFactory.RManager catalog = CommerceContext.Current.CatalogSystem.GetCatalog(Utility.catalogName) If rm Is Nothing Then 'Resources are unavailable Server.Transfer(Utility.errorPage) End If            End Sub

Sub Page_Load(ByVal sender As Object, ByVal args As EventArgs) Dim SelectedCulture As CultureInfo Dim coll As NameValueCollection = Request.QueryString strLanguage = coll(Utility.languageLabel) Try SelectedCulture = CultureInfo.CreateSpecificCulture(strLanguage) Catch e As Exception SelectedCulture = CultureInfo.CreateSpecificCulture(Utility.englishLanguage) strLanguage = Utility.englishLanguage End Try Footer.Language = strLanguage catalog.ActiveLanguage = strLanguage If Not (SelectedCulture Is Nothing) Then Thread.CurrentThread.CurrentCulture = SelectedCulture Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture End If                Dim productid As String = coll(Utility.productID) If Not IsPostBack AndAlso Not (productid Is Nothing) Then Try Dim myProduct As Product = catalog.GetProduct(productid) Dim data As DataSet = myProduct.GetProductProperties productdt = data.Tables(0).Rows(0) Try productDisplayName = CType(productdt(&quot;name&quot;), String) Catch e As Exception productDisplayName = &quot;&quot; End Try Try ProductImage.ImageUrl = CType(productdt(&quot;Image_filename&quot;), String) Catch e As Exception ProductImage.ImageUrl = Nothing End Try Try ProductIDLabel.Text = CType(productdt(&quot;name&quot;), String) Catch e As Exception ProductIDLabel.Text = Nothing End Try Try IntroDateLabel.Text = rm.GetString(Utility.productPageIntro) Dim dateTime As DateTime = CType(productdt(&quot;IntroductionDate&quot;), DateTime) IntroDate.Text = dateTime.ToShortDateString Catch e As Exception IntroDateLabel.Text = Nothing End Try Try PriceLabel.Text = rm.GetString(Utility.productPagePrice) Price.Text = &quot;$&quot; & productdt(&quot;cy_list_price&quot;).ToString Catch e As Exception PriceLabel.Text = Nothing End Try Try ProductCodeLabel.Text = rm.GetString(Utility.productPageCode) ProductCode.Text = productdt(&quot;ProductCode&quot;).ToString Catch e As Exception ProductCodeLabel.Text = Nothing End Try Try Dim variantData As DataSet = myProduct.GetVariants VariantListing.DataSource = variantData VariantListing.DataBind If Not (0 = variantData.Tables(0).Rows.Count) Then Variants.Text = rm.GetString(Utility.productPageColor) Else Variants.Text = Nothing End If                            Catch e As Exception Variants.Text = Nothing End Try Try DescribeLabel.Text = rm.GetString(Utility.productPageDescription) Description.Text = CType(productdt(&quot;Description&quot;), String) Catch e As Exception DescribeLabel.Text = Nothing End Try Try Size.Text = CType(productdt(&quot;ProductSize&quot;).ToString, String) If Not (&quot;&quot; = Size.Text.Trim) Then SizeLabel.Text = rm.GetString(Utility.productPageSize) End If                            Catch e As Exception SizeLabel.Text = Nothing End Try Try Dim available As Integer = CType(productdt(&quot;OnSale&quot;), Integer) If 1 = available Then AvailableLabel.Text = rm.GetString(Utility.productPageAvailable) Else AvailableLabel.Text = rm.GetString(Utility.productPageUnavailable) End If                            Catch e As Exception AvailableLabel.Text = Nothing End Try Catch e As Exception 'Eat exception End Try End If            End Sub

<%=rm.GetString(Utility.productPageTitle) & &quot; &quot; & productDisplayName%> <LINK REL=&quot;stylesheet&quot; TYPE=&quot;text/css&quot; HREF=&quot;sitelet.css&quot;> </HEAD>  <%= rm.GetString(Utility.productPageTitle) & &quot; &quot; & productDisplayName%> </DIV> <BR> <BR> <form id=&quot;Productform&quot; method=&quot;post&quot; runat=&quot;server&quot;> <asp:Table id=&quot;Product&quot; runat=&quot;server&quot; Width=&quot;50%&quot; cellpadding=&quot;2&quot; cellspacing=&quot;0&quot; Height=&quot;175px&quot;> <asp:TableRow> <asp:TableCell ColumnSpan=&quot;100&quot;> <B> <asp:Label ID=&quot;ProductIDLabel&quot; Runat=&quot;server&quot; /> </B> <asp:Label ID=&quot;IntroDateLabel&quot; Runat=&quot;server&quot; /> <asp:Label ID=&quot;IntroDate&quot; Runat=&quot;server&quot; /> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell ColumnSpan=&quot;70&quot;> <asp:Image id=&quot;ProductImage&quot; runat=&quot;server&quot;></asp:Image> </asp:TableCell> <asp:TableCell ColumnSpan=&quot;30&quot;> <b> <asp:Label ID=&quot;PriceLabel&quot; Runat=&quot;server&quot; /> </b> <asp:Label ID=&quot;Price&quot; Runat=&quot;server&quot; /> <b> <asp:Label ID=&quot;ProductCodeLabel&quot; Runat=&quot;server&quot; /> </b> <asp:Label ID=&quot;ProductCode&quot; Runat=&quot;server&quot; /> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell ColumnSpan=&quot;100&quot;> <B> <asp:Label ID=&quot;Variants&quot; Runat=&quot;server&quot; /> </B> <asp:Repeater id=&quot;VariantListing&quot; runat=&quot;server&quot;> <ItemTemplate> <asp:Label id=&quot;Color&quot; runat=&quot;server&quot;> <%# DataBinder.Eval(Container.DataItem, &quot;ProductColor&quot;) %> </asp:Label> </ItemTemplate> <SeparatorTemplate> <BR> </SeparatorTemplate> </asp:Repeater> <BR> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell ColumnSpan=&quot;100&quot;> <B> <asp:Label ID=&quot;DescribeLabel&quot; Runat=&quot;server&quot; /> </B> <BR> <asp:Label ID=&quot;Description&quot; Runat=&quot;server&quot; /> <BR> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell ColumnSpan=&quot;100&quot;> <B> <asp:Label ID=&quot;SizeLabel&quot; Runat=&quot;server&quot; /> </B> <asp:Label ID=&quot;Size&quot; Runat=&quot;server&quot; /> <BR> </asp:TableCell> </asp:TableRow> </asp:Table> <asp:Label ID=&quot;AvailableLabel&quot; Runat=&quot;server&quot; /> <Localized:Footer runat=&quot;server&quot; id=&quot;Footer&quot; /> </HTML>

Propsearch.aspx
<%@Register TagPrefix=&quot;Localized&quot; TagName=&quot;Footer&quot; src=&quot;footer.ascx&quot; %> <%@Import Namespace=&quot;System.Data&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Catalog&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Configuration&quot;%> <%@Import Namespace=&quot;Microsoft.CommerceServer.Runtime.Diagnostics&quot;%> <%@Import Namespace=&quot;catalogsitelet&quot;%> <%@Import Namespace=&quot;System.Threading&quot;%> <%@Import Namespace=&quot;System.Resources&quot;%> <%@Import Namespace=&quot;System.Globalization&quot;%> <%@ Page Description=&quot;Localized Page&quot; CodePage=&quot;65001&quot; %>

<HTML>  <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;> <meta name=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 7.0&quot;> <meta name=&quot;CODE_LANGUAGE&quot; Content=&quot;VB&quot;> <meta name=&quot;vs_defaultClientScript&quot; content=&quot;JavaScript (ECMAScript)&quot;> <meta name=&quot;vs_targetSchema&quot; content=&quot;http://schemas.microsoft.com/intellisense/ie5&quot;> <script runat=&quot;Server&quot; Language=&quot;VB&quot;> Private rm As ResourceManager Private strLanguage As String = Nothing Private catDisplayName As String = Nothing Private productCode As String = Nothing Private introductionDate As String = Nothing Private productName As String = Nothing

Sub Page_Init(ByVal sender As Object, ByVal args As EventArgs) 'Get the ResourceManager from the Application object rm = ResourceFactory.RManager If rm Is Nothing Then 'Do something sensible if resources are unavailable Server.Transfer(Utility.errorPage) End If            End Sub

Sub Page_Load(ByVal sender As Object, ByVal args As EventArgs) Dim SelectedCulture As CultureInfo Dim coll As NameValueCollection = Request.QueryString strLanguage = coll(Utility.languageLabel) Try SelectedCulture = CultureInfo.CreateSpecificCulture(strLanguage) Catch e As Exception 'Fallback to English language SelectedCulture = CultureInfo.CreateSpecificCulture(Utility.englishLanguage) strLanguage = Utility.englishLanguage End Try

'Set Language on footer control Footer.Language = strLanguage 'Set culture for current thread If Not (SelectedCulture Is Nothing) Then Thread.CurrentThread.CurrentCulture = SelectedCulture Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture End If               'Initialize controls with appropriate texts ProdCode.Text = rm.GetString(Utility.productPageCode) IntroDate.Text = rm.GetString(Utility.propSearchIntro) Name.Text = rm.GetString(Utility.propSearchTitle) Button.Text = rm.GetString(Utility.ftSearchSearch) catDisplayName = Utility.GetDisplayName(Utility.catalogName, strLanguage) End Sub

Sub Button_Click(ByVal sender As Object, ByVal args As EventArgs) Dim searchClause As String = Nothing Try 'To keep count of records found Dim totalRecords As Integer = 0 Dim startPage As Integer = 1

'Product code productCode = ProdCodeText.Text.Trim If Not (&quot;&quot; = productCode) Then BuildClause(searchClause, &quot;productcode&quot;, productCode, False) End If                    'Introduction date introductionDate = IntroDateText.Text.Trim If Not (&quot;&quot; = introductionDate) Then BuildClause(searchClause, &quot;introductiondate&quot;, introductionDate, True) End If                    'Product name productName = NameText.Text.Trim If Not (&quot;&quot; = productName) Then BuildClause(searchClause, &quot;name&quot;, productName, False) End If                    Dim searchResult As DataSet = PropertySearch(searchClause, startPage, totalRecords) Paging.Visible = False

'If products found If Not (searchResult Is Nothing) AndAlso 0 < searchResult.Tables(0).Rows.Count Then SearchResultRepeater.Visible = True SearchResultRepeater.DataSource = searchResult SearchResultRepeater.DataBind Matches.Text = totalRecords.ToString & &quot; &quot; & rm.GetString(Utility.propSearchTotal) Else SearchResultRepeater.Visible = False Seprator.InnerHtml = Nothing Pages.Text = Nothing Matches.Text = Nothing End If                    'Do paging If totalRecords > Utility.numberOfRecordToDisplay Then Dim pagingTable As DataTable = Utility.DoPaging(totalRecords, Utility.numberOfRecordToDisplay, searchClause) Paging.DataSource = pagingTable.DefaultView Paging.DataBind Paging.Visible = True Seprator.InnerHtml = &quot;<BR>&quot; Pages.Text = rm.GetString(Utility.ftSearchPage) End If                    ProdCodeText.Text = Nothing IntroDateText.Text = Nothing NameText.Text = Nothing Catch e As Exception 'Eat exception End Try End Sub

'Redirects to product page Sub ProductListing_ItemCommand(ByVal sender As Object, ByVal args As RepeaterCommandEventArgs) Response.Redirect(rm.GetString(Utility.productPageUrl) & &quot;?&quot; & Utility.languageLabel & &quot;=&quot; & strLanguage & &quot;&&quot; & Utility.productID & &quot;=&quot; & CType(args.CommandArgument, String)) End Sub

'Page click response Sub PageClick_ItemCommand(ByVal sender As Object, ByVal args As RepeaterCommandEventArgs) Dim searchClause As String = CType(args.CommandArgument, String) Dim totalRecords As Integer = 0 Dim page As Integer = args.Item.ItemIndex + 1 Dim searchResult As DataSet = PropertySearch(searchClause, page, totalRecords)

'If products found If 0 < searchResult.Tables(0).Rows.Count Then SearchResultRepeater.Visible = True SearchResultRepeater.DataSource = searchResult SearchResultRepeater.DataBind Seprator.InnerHtml = &quot;<BR>&quot; Pages.Text = rm.GetString(&quot;L_Page_FTSearch_Page&quot;) Matches.Text = totalRecords.ToString & &quot; &quot; & rm.GetString(Utility.propSearchTotal) Else SearchResultRepeater.Visible = False Seprator.InnerHtml = Nothing Pages.Text = Nothing End If            End Sub

'Creates Where clause for SQL statement Public Sub BuildClause(ByRef searchCaluse As String, ByVal sKey As String, ByVal sValue As String, ByVal bEquals As Boolean) If bEquals Then If searchCaluse Is Nothing Then searchCaluse = sKey & &quot; = N&quot; & &quot;'&quot; & sValue & &quot;'&quot; Else searchCaluse = searchCaluse & &quot; or &quot; & sKey & &quot; = N&quot; & &quot;'&quot; & sValue & &quot;'&quot; End If                Else If searchCaluse Is Nothing Then searchCaluse = sKey & &quot; like N&quot; & &quot;'&quot; & sValue & &quot;'&quot; Else searchCaluse = searchCaluse & &quot; or &quot; & sKey & &quot; like N&quot; & &quot;'&quot; & sValue & &quot;'&quot; End If                End If             End Sub

Function PropertySearch(ByVal searchstring As String, ByVal page As Integer, ByRef totalRecords As Integer) As DataSet 'Search Options Dim searchOptions As CatalogSearchOptions = Utility.SetSearchOptions(page, Utility.numberOfRecordToDisplay, &quot;name&quot;) 'Look for the products supporting search criteria Dim search As CatalogSearch = New CatalogSearch(CommerceContext.Current.CatalogSystem) search.CatalogNames = Utility.catalogName search.SqlWhereClause = searchstring search.SearchOptions = searchOptions Return search.Search(totalRecords) End Function

<%=rm.GetString(Utility.propPageTitle) & &quot; &quot; & catDisplayName%> <LINK REL=&quot;stylesheet&quot; TYPE=&quot;text/css&quot; HREF=&quot;sitelet.css&quot;> </HEAD>  <%= rm.GetString(Utility.propPageTitle) & &quot; &quot; & catDisplayName%> </DIV> <form id=&quot;propSearch&quot; method=&quot;post&quot; runat=&quot;server&quot;> <BR> <asp:Table id=&quot;display&quot; runat=&quot;server&quot;> <asp:TableRow> <asp:TableCell> <asp:Label id=&quot;ProdCode&quot; runat=&quot;server&quot;>Product Code:</asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox id=&quot;ProdCodeText&quot; runat=&quot;server&quot;></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label id=&quot;IntroDate&quot; runat=&quot;server&quot;>Introduction date:</asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox id=&quot;IntroDateText&quot; runat=&quot;server&quot;></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label id=&quot;Name&quot; runat=&quot;server&quot;>Name:</asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox id=&quot;NameText&quot; runat=&quot;server&quot;></asp:TextBox> </asp:TableCell> </asp:TableRow> </asp:Table> <asp:Button id=&quot;Button&quot; runat=&quot;server&quot; Text=&quot;Button&quot; OnClick=&quot;Button_Click&quot; /> <asp:Label id=&quot;Matches&quot; runat=&quot;server&quot; /> <asp:Repeater id=&quot;SearchResultRepeater&quot; OnItemCommand=&quot;ProductListing_ItemCommand&quot; runat=&quot;server&quot;> <ItemTemplate> <asp:LinkButton id=&quot;SelectProductBtn&quot; CommandName=&quot;Select&quot; CommandArgument='<%# CType(Container.DataItem, DataRowView)(&quot;ProductID&quot;) %>' runat=&quot;server&quot;> <%# DataBinder.Eval(Container.DataItem, &quot;Name&quot;) %> </asp:LinkButton> (                   <asp:Label id=&quot;Describe&quot; runat=&quot;server&quot;>                        <%# DataBinder.Eval(Container.DataItem, &quot;description&quot;) %>                    </asp:Label>                    ) </ItemTemplate> <SeparatorTemplate> <BR> <BR> </SeparatorTemplate> </asp:Repeater>  <asp:Label id=&quot;Pages&quot; runat=&quot;server&quot; /> <asp:Repeater id=&quot;Paging&quot; OnItemCommand=&quot;PageClick_ItemCommand&quot; runat=&quot;server&quot;> <ItemTemplate> <asp:LinkButton id=&quot;PageClick&quot; CommandName=&quot;Select&quot; CommandArgument='<%# CType(Container.DataItem, DataRowView)(&quot;Clause&quot;) %>' runat=&quot;server&quot;> <%# DataBinder.Eval(Container.DataItem, &quot;Page&quot;) %> </asp:LinkButton> </ItemTemplate> </asp:Repeater> <Localized:Footer runat=&quot;server&quot; id=&quot;Footer&quot; /> </HTML>

<div class="references_section">