<% '************************************************************************* ' ASP Scripting: ' Filename: view_lifestyles_default.asp ' Written by: Angela Madarang ' Date: May 15, 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("collectionNo") %> Welcome to Charister.com
<% If strPageNo <> 0 Then Response.Write "" End If %>
<% If strPageNo <> 0 Then Call printPageNavBar_PerPage( strPageNo, strProductLineId ) Else Response.Write "

" End If %>
<% Call printProductLineTitle( strProductLineId ) %>
<% Call printPatterns( strPageNo ) %>
" 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 ) 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 ' *********************************************************** ' ay051405 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: Angela Madarang ' Date: May 13, 2005 '************************************************************************* Function printPatterns( strPageNo ) Dim strImage If strPageNo > 0 Then nPatternsPerPage = BED_LINEN_NUMBER_PATTERNS_PER_PAGE 'Obtain Records from Database 'ay062205 Do not show Sales LifeStyles ' strConstraints = strConstraints + " ORDER BY collectionOrder" strConstraints = " WHERE collectionOrder<100" + " ORDER BY collectionOrder" strTable = "TLifeStyles" 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 strCollectionId = rs.Fields("collectionOrder") strCollectionName = rs.Fields("Name") strThumbnailLocation = rs.Fields("collection_Thumbnail_Location") strCollectionDescriptionUrl = "view_lifestyles_collection.asp?product_line_id=" & strProductLineId & "&nCollectionId=" & strCollectionId & "&page=1" '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 'ay060305 Add view Sale If rs.Fields("collectionOrder") = CLng(SALES_COLLECTION) Then Response.Write "" & "
" & strCollectionName & "
" & vbCrLf Else Response.Write "" & "
" & strCollectionName & "
" & vbCrLf End If Response.Write "
" & vbCrLf Response.Write "

" & vbCrLf End If Set rs = Nothing Else nPatternsPerPage = 100 'Obtain Records from Database strConstraints = strConstraints + " ORDER BY collectionNameId ASC, viewOrder ASC" 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 If NOT (rsCollection.EOF AND rsCollection.BOF) Then strCollectionName = rsCollection.Fields("Name") End If 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 Set rs = Nothing 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 = LIFESTYLES_ACCESSORIES Then ' strTable = "dirPatterns" strTable = "TLifeStyles" End If 'Check Record Count from the Database '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 '******************************************************** strSQL = "SELECT * FROM " & strTable Set rs = server.CreateObject("ADODB.RecordSet") rs.Open strTable, DATABASE_DRIVER & DATABASE_PATH, adOpenStatic, adLockReadOnly, adCmdTable ' strSQL = "SELECT * FROM " & strTable ' strSQL = strSQL + " WHERE collectionNameId=" & CLng(nCollectionNo) ' strSQL = strSQL + " ORDER BY collectionOrder ASC" '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 Set rs = Nothing getRecordCountByPatterns = nRecordCount End Function %>