<% '************************************************************************* ' ASP Scripting: ' Filename: view_lifestyles_default.asp ' Written by: Angela Madarang ' Date: May 16, 2005 '************************************************************************* ' Description: This is one method of presenting the Generic Category ' Page. '************************************************************************* ' Revision History: '************************************************************************* %> <% 'Retrieve Web Parameters strProductLineId = Request("product_line_id") strPageNo = Request("page") nPageNo = CInt( strPageNo ) nCollectionNo = Request("nCollectionId") %> Welcome to Charister.com
<% 'ay060305 Add View Sale If strPageNo <> 0 Then If nCollectionNo <> SALES_COLLECTION Then Response.Write "" End If End If %>
<% 'ay060305 Add View Sale If strPageNo <> 0 Then If nCollectionNo <> SALES_COLLECTION Then Call printPageNavBar_PerPage( strPageNo, strProductLineId, nCollectionNo) End If Else Response.Write "

" End If %>
<% Call printProductLineTitle( strPageNo, strProductLineId, nCollectionNo ) %>
<% Call printPatterns( strPageNo, nCollectionNo ) %>
" Call printPageNavBar_AllPages() Response.Write "
<% '************************************************************************* ' Function: printPageNavBar_PerPage ' Description: prints the Page Navigational Bar per Page ' Parameters: none ' Returns: none ' Written by: Wilbert Madarang ' Date: January 25, 2003 '************************************************************************* Function printPageNavBar_PerPage( strPageNo, strProductLineId, nCollectionNo ) strUrl = getUrl() strCurrentPage = strPageNo nRecordCount = getRecordCountByCollection( strProductLineId, nCollectionNo ) strLastPage = getLastPage( nRecordCount, BED_LINEN_NUMBER_PATTERNS_PER_PAGE ) strPrevPage = getPrevPage( strCurrentPage ) strNextPage = getNextPage( strCurrentPage, strLastPage ) Response.Write "" Response.Write "" Response.Write "" Response.Write " Page " & strCurrentPage & " of " & strLastPage & " " Response.Write "" Response.Write "" Response.Write " " End Function '************************************************************************* ' Function: printPageNavBar_AllPages ' Description: prints the Page Navigational Bar for All Pages ' Parameters: none ' Returns: none ' Written by: Wilbert Madarang ' Date: January 25, 2003 '************************************************************************* Function printPageNavBar_AllPages() strUrl = getUrl() strCurrentPage = strPageNo nRecordCount = getRecordCountByCollection( strProductLineId, nCollectionNo ) strLastPage = getLastPage( nRecordCount, BED_LINEN_NUMBER_PATTERNS_PER_PAGE ) Response.Write "" & vbCrLf Response.Write "" & vbCrLf For pageNo = 1 to CInt(strLastPage) Response.Write "" & vbCrLf Next Response.Write "
" & vbCrLf Response.Write "" & "" & " " &"" Response.Write "" & vbCrLf Response.Write "" & " " & pageNo & " " &"" Response.Write "
" & vbCrLf End Function '************************************************************************* ' Function: printProductLineTitle ' Description: prints the product line Title ' Parameters: none ' Returns: none ' Written by: Wilbert Madarang ' Date: January 25, 2003 '************************************************************************* Function printProductLineTitle( strPageNo, strProductLineId, nCollectionNo ) ' Dim strTitleImgLocation Dim strProductLine, strCollectionName strSQL = "SELECT * FROM dirProductLines WHERE plId=" & strProductLineId ' strSQL = strSQL + " ORDER BY ActivityId ASC" If strSQL <> nil Then 'Execute Query Call openDataConnection Set rs = dataConnection.Execute( strSQL ) Call closeDataConnection strProductLine = rs.Fields("plDescription") End If Set rs = Nothing ' Don't need to find Collection Name when View All If strPageNo = 0 And nCollectionNo = 0 Then Else strSQL = "SELECT * FROM TLifeStyles WHERE collectionOrder=" & nCollectionNo ' strSQL = strSQL + " ORDER BY ActivityId ASC" If strSQL <> nil Then 'Execute Query Call openDataConnection Set rs = dataConnection.Execute( strSQL ) Call closeDataConnection ' *********************************************************** ' ay051405 Use Words instead of image to make it more dynamic ' *********************************************************** ' SELECT CASE strProductLineId ' CASE BED_LINEN_COLLECTION ' strTitleImgLocation = BED_LINEN_COLLECTION_GIF ' strTitleImgLocation2 = LOFT_GIF ' CASE DECORATIVE_PILLOWS ' strTitleImgLocation = DECORATIVE_PILLOWS_GIF ' strTitleImgLocation2 = CELLINI_GIF ' CASE WINDOW_TREATMENT ' strTitleImgLocation = WINDOW_TREATMENT_GIF ' strTitleImgLocation2 = VIVACE_GIF ' CASE ACCESSORIES ' strTitleImgLocation = ACCESSORIES_GIF ' strTitleImgLocation2 = AVIGNON_GIF ' CASE FURNISHINGS ' strTitleImgLocation = FURNISHINGS_GIF ' strTitleImgLocation2 = COUTURE_GIF ' CASE ELSE ' END SELECT ' Response.Write " " strCollectionName = rs.Fields("Name") End If Set rs = Nothing End If ' Don't need to find Collection Name when View All If strPageNo = 0 And nCollectionNo = 0 Then Response.Write "" & strProductLine & "" ' ay060305 Add View Sale Elseif nCollectionNo = SALES_COLLECTION Then Response.Write "" & strProductLine & " - Sale & Special Values" Else Response.Write "" & strProductLine & " - " & strCollectionName & " Collection" End If End Function '************************************************************************* ' Function: printPatterns ' Description: print Patterns ' Parameters: strPage Number ' Returns: none ' Written by: Wilbert Madarang ' Date: January 27, 2003 '************************************************************************* Function printPatterns( strPageNo, nCollectionNo ) Dim strImage, strConstraints, nCollectionId strConstraints = "" nCollectionId = 0 If strPageNo > 0 Then nPatternsPerPage = BED_LINEN_NUMBER_PATTERNS_PER_PAGE Else nPatternsPerPage = 100 End If 'ay060305 Add view Sales items 'ay062205 Remove Sales items ' If nCollectionNo = SALES_COLLECTION Then ' nLastPatternId = 10000 ' strSQL = "SELECT * FROM TLifestylesProducts WHERE bSale=1 ORDER BY collectionNameId ASC, viewOrder ASC" ' Call openDataConnection() ' Set rs = dataConnection.Execute( strSQL ) ' Call closeDataConnection() 'Adjust Cursor ' If strPageNo > 0 Then ' nRecordNumber = (CInt(strPageNo)-1) * nPatternsPerPage ' Else ' nRecordNumber = 0 ' End If ' If NOT (rs.BOF AND rs.EOF) Then ' rs.Move nRecordNumber 'Create New Table ' Response.Write "" & vbCrLf 'Print Results ' FOR i = 1 to ( nPatternsPerPage / BED_LINEN_NUMBER_COLUMNS_PER_PAGE ) ' If rs.EOF Then ' Exit For ' End If 'Create New Row ' Response.Write "" & vbCrLf ' FOR j = 1 to BED_LINEN_NUMBER_COLUMNS_PER_PAGE 'Create New Column ' If rs.EOF Then ' Exit For ' End if ' strPatternId = rs.Fields("patternId") ' strPatternName = rs.Fields("patternName") ' strThumbnailLocation = rs.Fields("pattern_Thumbnail_Location") ' strPatternDescriptionUrl = "view_lifestyles_description.asp?product_line_id=" & strProductLineId & "&patternId=" & strPatternId 'Added Put 'Coming Soon' Sign Here ' If IsNull( strThumbnailLocation ) OR ( LEN(TRIM(strThumbnailLocation))<=0 ) Then ' strThumbnailLocation = COMING_SOON_THUMBNAIL ' End If ' If nCollectionId <> rs.Fields("collectionNameId") And strPageNo = 0 And nCollectionNo = 0 Then ' If nCollectionId <> rs.Fields("collectionNameId") Then ' nCollectionId = rs.Fields("collectionNameId") ' strSQL = "SELECT * FROM TLifeStyles WHERE collectionOrder=" & nCollectionId ' If strSQL <> nil Then 'Execute Query ' Call openDataConnection ' Set rsCollection = dataConnection.Execute( strSQL ) ' Call closeDataConnection ' strCollectionName = rsCollection.Fields("Name") ' End If ' Set rsCollection = Nothing ' Response.Write "" & vbCrLf ' j = 1 ' End If ' Response.Write "" & vbCrLf ' rs.MoveNext ' NEXT ' Response.Write "" & vbCrLf ' NEXT ' Response.Write "
" & vbCrLf ' Response.Write "" & strCollectionName & "
" & vbCrLf ' Response.Write "
" & vbCrLf ' Response.Write "" & vbCrLf ' Response.Write "" & "
" & strPatternName & "
" & vbCrLf ' Response.Write "
" & vbCrLf ' Response.Write "

" & vbCrLf ' End If ' Else 'Obtain Records from Database If nCollectionNo <> 0 Then strConstraints = " WHERE collectionNameId=" & CLng(nCollectionNo) End If strConstraints = strConstraints + " ORDER BY collectionNameId, viewOrder" strTable = "TLifestylesProducts" strSQL = "SELECT * FROM " & strTable & strConstraints Call openDataConnection() Set rs = dataConnection.Execute( strSQL ) Call closeDataConnection() 'Adjust Cursor If strPageNo > 0 Then nRecordNumber = (CInt(strPageNo)-1) * nPatternsPerPage Else nRecordNumber = 0 End If If NOT (rs.BOF AND rs.EOF) Then rs.Move nRecordNumber 'Create New Table Response.Write "" & vbCrLf 'Print Results FOR i = 1 to ( nPatternsPerPage / BED_LINEN_NUMBER_COLUMNS_PER_PAGE ) If rs.EOF Then Exit For End If 'Create New Row Response.Write "" & vbCrLf FOR j = 1 to BED_LINEN_NUMBER_COLUMNS_PER_PAGE 'Create New Column If rs.EOF Then Exit For End if strPatternId = rs.Fields("patternId") strPatternName = rs.Fields("patternName") strThumbnailLocation = rs.Fields("pattern_Thumbnail_Location") strPatternDescriptionUrl = "view_lifestyles_description.asp?product_line_id=" & strProductLineId & "&patternId=" & strPatternId 'Added Put 'Coming Soon' Sign Here If IsNull( strThumbnailLocation ) OR ( LEN(TRIM(strThumbnailLocation))<=0 ) Then strThumbnailLocation = COMING_SOON_THUMBNAIL End If If nCollectionId <> rs.Fields("collectionNameId") And strPageNo = 0 And nCollectionNo = 0 Then nCollectionId = rs.Fields("collectionNameId") strSQL = "SELECT * FROM TLifeStyles WHERE collectionOrder=" & nCollectionId ' strSQL = strSQL + " ORDER BY ActivityId ASC" If strSQL <> nil Then 'Execute Query Call openDataConnection Set rsCollection = dataConnection.Execute( strSQL ) Call closeDataConnection strCollectionName = rsCollection.Fields("Name") End If Set rsCollection = Nothing Response.Write "" & vbCrLf j = 1 End If Response.Write "" & vbCrLf rs.MoveNext NEXT Response.Write "" & vbCrLf NEXT Response.Write "
" & vbCrLf Response.Write "" & strCollectionName & "
" & vbCrLf Response.Write "
" & vbCrLf Response.Write "" & vbCrLf Response.Write "" & "
" & strPatternName & "
" & vbCrLf Response.Write "
" & vbCrLf Response.Write "

" & vbCrLf End If ' End If End Function '************************************************************************* ' Function: getRecordCountByCollection ' Description: obtain the Record Count for Patterns or Lifestyles Products ' Parameters: product line ID ' Returns: the record count '************************************************************************* ' Written by: Wilbert Madarang ' Date: January 25, 2003 '************************************************************************* Function getRecordCountByCollection( strProductLineId, nCollectionNo ) Dim strTable Dim rs Dim nRecordCount nRecordCount = 0 'Identify Which Database Table to Lookup If strProductLineId = LIFESTYLES_ACCESSORIES Then strTable = "TLifestylesProducts" End If 'Check Record Count from the Database strSQL = "SELECT * FROM " & strTable strSQL = strSQL + " WHERE collectionNameId=" & CLng(nCollectionNo) 'Cannot use ADODB.openConnection Method because this is always a forward only RecordSet 'Use a RecordSet instance instead... '******************************************************** 'Begin of Change - Jan 26, 2003 '******************************************************** 'Call openDataConnection() 'Set rs = dataConnection.Execute( strSQL, adOpenKeyset ) 'Call closeDataConnection() '******************************************************** 'End of change - Jan 26, 2003 '******************************************************** '******************************************************** 'Begin of Change - May 14, 2005 ' Remove - Need to count the exact # of patterns in a Collection '******************************************************** ' Set rs = server.CreateObject("ADODB.RecordSet") ' rs.Open strTable, DATABASE_DRIVER & DATABASE_PATH, adOpenStatic, adLockReadOnly, adCmdTable '******************************************************** 'End of change - May 14, 2005 '******************************************************** Call openDataConnection Set rs = dataConnection.Execute( strSQL ) Call closeDataConnection 'Determine the Record Count If rs.EOF AND rs.BOF Then Else DO WHILE NOT rs.EOF nRecordCount = nRecordCount + 1 ' response.write "nRecordCount=" & nRecordCount & "
" rs.MoveNext LOOP ' rs.MoveLast ' If rs.RecordCount = -1 Then ' nRecordCount = 0 ' Else ' nRecordCount = rs.RecordCount ' End If End If rs.Close getRecordCountByCollection = nRecordCount End Function %>