<% '************************************************************************* ' ASP Scripting: ' Filename: view_bed_linen_patterns.asp ' Written by: Wilbert Madarang ' Date: January 25, 2002 '************************************************************************* ' 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 ) %> Welcome to Charister.com
<% Call printPageNavBar_PerPage() %>
<% Call printProductLineTitle( strProductLineId ) %>
<% Call printPatterns( strPageNo ) %>
<% Call printPageNavBar_AllPages() %>
<% '************************************************************************* ' 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() strUrl = getUrl() strCurrentPage = strPageNo nRecordCount = getRecordCountByPatterns( strProductLineId ) 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 = getRecordCountByPatterns( strProductLineId ) 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( strProductLineId ) Dim strTitleImgLocation ' *********************************************************** ' ay052505 Use Words instead of image to make it more dynamic ' *********************************************************** ' SELECT CASE strProductLineId ' CASE BED_LINEN_COLLECTION ' strTitleImgLocation = BED_LINEN_COLLECTION_GIF ' CASE DECORATIVE_PILLOWS ' strTitleImgLocation = DECORATIVE_PILLOWS_GIF ' CASE WINDOW_TREATMENT ' strTitleImgLocation = WINDOW_TREATMENT_GIF ' CASE ACCESSORIES ' strTitleImgLocation = ACCESSORIES_GIF ' CASE FURNISHINGS ' strTitleImgLocation = FURNISHINGS_GIF ' CASE ELSE ' END SELECT ' Response.Write "" 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 Response.Write "" & strProductLine & "" End Function '************************************************************************* ' Function: printPatterns ' Description: print Patterns ' Parameters: strPage Number ' Returns: none ' Written by: Wilbert Madarang ' Date: January 27, 2003 '************************************************************************* Function printPatterns( strPageNo ) Dim strImage If strPageNo > 0 Then nPatternsPerPage = BED_LINEN_NUMBER_PATTERNS_PER_PAGE Else nPatternsPerPage = 100 End If 'Obtain Records from Database strConstraints = " ORDER BY viewOrder" strTable = "dirPatterns " 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_bed_linen_pattern_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 Response.Write "" & vbCrLf rs.MoveNext NEXT Response.Write "" & vbCrLf NEXT Response.Write "
" & vbCrLf Response.Write "" & vbCrLf Response.Write "" & "
" & strPatternName & "
" & vbCrLf Response.Write "
" & vbCrLf Response.Write "

" & vbCrLf End If End Function '************************************************************************* ' Function: getRecordCountByPatterns ' Description: obtain the Record Count for Patterns ' Parameters: product line ID ' Returns: the record count '************************************************************************* ' Written by: Wilbert Madarang ' Date: January 25, 2003 '************************************************************************* Function getRecordCountByPatterns( strProductLineId ) Dim strTable Dim rs 'Identify Which Database Table to Lookup If strProductLineId = BED_LINEN_COLLECTION Then strTable = "dirPatterns" End If 'Check Record Count from the Database strSQL = "SELECT * FROM " & strTable '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 '******************************************************** Set rs = server.CreateObject("ADODB.RecordSet") rs.Open strTable, DATABASE_DRIVER & DATABASE_PATH, adOpenStatic, adLockReadOnly, adCmdTable 'Determine the Record Count If rs.EOF AND rs.BOF Then nRecordCount = 0 Else rs.MoveLast If rs.RecordCount = -1 Then nRecordCount = 0 Else nRecordCount = rs.RecordCount End If End If rs.Close getRecordCountByPatterns = nRecordCount End Function %>