<% Response.Expires = 0 Response.ExpiresAbsolute = Now() - 1 Response.AddHeader "pragma", "no-cache" Response.AddHeader "cache-control", "private, no-cache, no-store, must-revalidate" %> <% If Not IsLoggedIn And Request.Cookies(ewProjectName)("autologin") = "autologin" And Request.Cookies(ewProjectName)("password") <> "" Then Response.Redirect "login.asp" Call LoadUserLevel() If IsLoggedIn Then ewCurSec = CurrentUserLevelPriv("lakenasser") Else ewCurSec = GetAnonymousPriv("lakenasser") End If If (ewCurSec And ewAllowList) <> ewAllowList Then Response.Redirect "login.asp" %> <% ' Initialize common variables x_LakeNasserID = Null: ox_LakeNasserID = Null: z_LakeNasserID = Null x_LakeNasserLogo = Null: ox_LakeNasserLogo = Null: z_LakeNasserLogo = Null fs_x_LakeNasserLogo = 0: fn_x_LakeNasserLogo = "": ct_x_LakeNasserLogo = "" wd_x_LakeNasserLogo = 0: ht_x_LakeNasserLogo = 0: a_x_LakeNasserLogo = "" x_LakeNasserName = Null: ox_LakeNasserName = Null: z_LakeNasserName = Null x_Photo1 = Null: ox_Photo1 = Null: z_Photo1 = Null fs_x_Photo1 = 0: fn_x_Photo1 = "": ct_x_Photo1 = "" wd_x_Photo1 = 0: ht_x_Photo1 = 0: a_x_Photo1 = "" x_CruiseCategory = Null: ox_CruiseCategory = Null: z_CruiseCategory = Null x_CruiseItinerary = Null: ox_CruiseItinerary = Null: z_CruiseItinerary = Null x_CruiseDescription = Null: ox_CruiseDescription = Null: z_CruiseDescription = Null x_Photo2 = Null: ox_Photo2 = Null: z_Photo2 = Null fs_x_Photo2 = 0: fn_x_Photo2 = "": ct_x_Photo2 = "" wd_x_Photo2 = 0: ht_x_Photo2 = 0: a_x_Photo2 = "" x_Photo3 = Null: ox_Photo3 = Null: z_Photo3 = Null fs_x_Photo3 = 0: fn_x_Photo3 = "": ct_x_Photo3 = "" wd_x_Photo3 = 0: ht_x_Photo3 = 0: a_x_Photo3 = "" x_Photo4 = Null: ox_Photo4 = Null: z_Photo4 = Null fs_x_Photo4 = 0: fn_x_Photo4 = "": ct_x_Photo4 = "" wd_x_Photo4 = 0: ht_x_Photo4 = 0: a_x_Photo4 = "" x_Photo5 = Null: ox_Photo5 = Null: z_Photo5 = Null fs_x_Photo5 = 0: fn_x_Photo5 = "": ct_x_Photo5 = "" wd_x_Photo5 = 0: ht_x_Photo5 = 0: a_x_Photo5 = "" x_Cabinfacilities = Null: ox_Cabinfacilities = Null: z_Cabinfacilities = Null x_Cruisefacilities = Null: ox_Cruisefacilities = Null: z_Cruisefacilities = Null %> <% nStartRec = 0 nStopRec = 0 nTotalRecs = 0 nRecCount = 0 nRecActual = 0 sDbWhereMaster = "" sDbWhereDetail = "" sSrchAdvanced = "" psearch = "" psearchtype = "" sSrchBasic = "" sSrchWhere = "" sDbWhere = "" sOrderBy = "" sSqlMaster = "" nDisplayRecs = 20 nRecRange = 10 ' Multi Column nRecPerRow = 3 ' Open connection to the database Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str ' Handle Reset Command ResetCmd() ' Get Search Criteria for Advanced Search SetUpAdvancedSearch() ' Get Search Criteria for Basic Search SetUpBasicSearch() ' Build Search Criteria If sSrchAdvanced <> "" Then If sSrchWhere <> "" Then sSrchWhere = sSrchWhere & " AND " sSrchWhere = sSrchWhere & "(" & sSrchAdvanced & ")" End If If sSrchBasic <> "" Then If sSrchWhere <> "" Then sSrchWhere = sSrchWhere & " AND " sSrchWhere = sSrchWhere & "(" & sSrchBasic & ")" End If ' Save Search Criteria If sSrchWhere <> "" Then Session(ewSessionTblSearchWhere) = sSrchWhere nStartRec = 1 ' reset start record counter Session(ewSessionTblStartRec) = nStartRec Else sSrchWhere = Session(ewSessionTblSearchWhere) Call RestoreSearch() End If ' Build Filter condition sDbWhere = "" If (ewCurSec And ewAllowList) <> ewAllowList Then sDbWhere = "(0=1)" End If If sDbWhereDetail <> "" Then If sDbWhere <> "" Then sDbWhere = sDbWhere & " AND " sDbWhere = sDbWhere & "(" & sDbWhereDetail & ")" End If If sSrchWhere <> "" Then If sDbWhere <> "" Then sDbWhere = sDbWhere & " AND " sDbWhere = sDbWhere & "(" & sSrchWhere & ")" End If ' Set Up Sorting Order sOrderBy = "" SetUpSortOrder() ' Set up SQL sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sDbWhere, sOrderBy) 'Response.Write sSql ' Uncomment to show SQL for debugging %> <% ' Set up Record Set Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = 3 rs.Open sSql, conn, 1, 2 nTotalRecs = rs.RecordCount If nDisplayRecs <= 0 Then ' Display All Records nDisplayRecs = nTotalRecs End If nStartRec = 1 SetUpStartRec() ' Set Up Start Record Position %>

 

Lake Nasser Name  
">
Cruise Category  
<% lst_x_CruiseCategory = "" Response.Write lst_x_CruiseCategory %>
   Show all  Advanced Search
checked<% End If %>>Exact phrase  checked<% End If %>>All words  checked<% End If %>>Any word
<% If (ewCurSec And ewAllowAdd) = ewAllowAdd Then %>
Add

<% End If %> <% If Session(ewSessionMessage) <> "" Then %>

<%= Session(ewSessionMessage) %>

<% Session(ewSessionMessage) = "" ' Clear message End If %> <% If nTotalRecs > 0 Then %>
<% ' Set the last record to display nStopRec = nStartRec + nDisplayRecs - 1 ' Move to first record directly for performance reason nRecCount = nStartRec - 1 If Not rs.Eof Then rs.MoveFirst rs.Move nStartRec - 1 End If nRecActual = 0 Do While (Not rs.Eof) And (nRecCount < nStopRec) nRecCount = nRecCount + 1 If CLng(nRecCount) >= CLng(nStartRec) Then nRecActual = nRecActual + 1 ' Set row color sItemRowClass = " class=""ewTableRow""" sListTrJs = "" ' Display alternate color for rows If nRecCount Mod 2 <> 1 Then sItemRowClass = " class=""ewTableRow""" End If x_LakeNasserID = rs("LakeNasserID") x_LakeNasserLogo = rs("LakeNasserLogo") x_LakeNasserName = rs("LakeNasserName") x_Photo1 = rs("Photo1") x_CruiseCategory = rs("CruiseCategory") x_CruiseItinerary = rs("CruiseItinerary") x_CruiseDescription = rs("CruiseDescription") x_Photo2 = rs("Photo2") x_Photo3 = rs("Photo3") x_Photo4 = rs("Photo4") x_Photo5 = rs("Photo5") x_Cabinfacilities = rs("Cabinfacilities") x_Cruisefacilities = rs("Cruisefacilities") %> <% If (nRecActual Mod nRecPerRow = 1) OR (nRecPerRow < 2) Then %> <% End If %> <% If (nRecActual Mod nRecPerRow = 0) Or (nRecPerRow < 2) Then %> <% End If %> <% End If rs.MoveNext Loop %> <% If (nRecActual Mod nRecPerRow) <> 0 Then For i = 1 to (nRecPerRow - nRecActual Mod nRecPerRow) %> <% Next %> <% End If %>
>
"> <% Response.Write x_LakeNasserName %>
<% If Not IsNull(x_Photo1) Then %> "> <% End If %>
<% If Not IsNull(x_CruiseCategory) Then sSqlWrk = "SELECT `HotelCategory` FROM `hotelcategory`" sTmp = x_CruiseCategory sSqlWrk = sSqlWrk & " WHERE `HotelCategory` = '" & AdjustSql(sTmp) & "'" Set rswrk = conn.Execute(sSqlWrk) If Not rswrk.Eof Then sTmp = rswrk("HotelCategory") End If rswrk.Close Set rswrk = Nothing Else sTmp = Null End If ox_CruiseCategory = x_CruiseCategory ' Backup Original Value x_CruiseCategory = sTmp %> <% Response.Write x_CruiseCategory %> <% x_CruiseCategory = ox_CruiseCategory ' Restore Original Value %>
<% If (ewCurSec And ewAllowView) = ewAllowView Then %> <% End If %> <% If (ewCurSec And ewAllowEdit) = ewAllowEdit Then %> ">Edit  <% End If %> <% If (ewCurSec And ewAllowDelete) = ewAllowDelete Then %> Delete <% End If %>
 
<% If nRecActual > 0 Then %> <% If (ewCurSec And ewAllowDelete) = ewAllowDelete Then %>

<% End If %> <% End If %>

<% End If %> <% ' Close recordset and connection rs.Close Set rs = Nothing conn.Close Set conn = Nothing %>
<% ' Display page numbers If nTotalRecs > 0 Then rsEof = (nTotalRecs < (nStartRec + nDisplayRecs)) If CLng(nTotalRecs) > CLng(nDisplayRecs) Then ' Find out if there should be Backward or Forward Buttons on the TABLE. If nStartRec = 1 Then isPrev = False Else isPrev = True PrevStart = nStartRec - nDisplayRecs If PrevStart < 1 Then PrevStart = 1 %> Prev <% End If If (isPrev Or (Not rsEof)) Then x = 1 y = 1 dx1 = ((nStartRec-1)\(nDisplayRecs*nRecRange))*nDisplayRecs*nRecRange+1 dy1 = ((nStartRec-1)\(nDisplayRecs*nRecRange))*nRecRange+1 If (dx1+nDisplayRecs*nRecRange-1) > nTotalRecs Then dx2 = (nTotalRecs\nDisplayRecs)*nDisplayRecs+1 dy2 = (nTotalRecs\nDisplayRecs)+1 Else dx2 = dx1+nDisplayRecs*nRecRange-1 dy2 = dy1+nRecRange-1 End If While x <= nTotalRecs If x >= dx1 And x <= dx2 Then If CLng(nStartRec) = CLng(x) Then %> <%=y%> <% Else %> <%=y%> <% End If x = x + nDisplayRecs y = y + 1 ElseIf x >= (dx1-nDisplayRecs*nRecRange) And x <= (dx2+nDisplayRecs*nRecRange) Then If x+nRecRange*nDisplayRecs < nTotalRecs Then %> <%=y%>-<%=y+nRecRange-1%> <% Else ny=(nTotalRecs-1)\nDisplayRecs+1 If ny = y Then %> <%=y%> <% Else %> <%=y%>-<%=ny%> <% End If End If x=x+nRecRange*nDisplayRecs y=y+nRecRange Else x=x+nRecRange*nDisplayRecs y=y+nRecRange End If Wend End If ' Next link If NOT rsEof Then NextStart = nStartRec + nDisplayRecs isMore = True %> Next <% Else isMore = False End If %>
<% End If If CLng(nStartRec) > CLng(nTotalRecs) Then nStartRec = nTotalRecs nStopRec = nStartRec + nDisplayRecs - 1 nRecCount = nTotalRecs - 1 If rsEof Then nRecCount = nTotalRecs If nStopRec > nRecCount Then nStopRec = nRecCount %> Cruises <%= nStartRec %> to <%= nStopRec %> of <%= nTotalRecs %> <% Else %> <% If (ewCurSec And ewAllowList) = ewAllowList Then %> <% If sSrchWhere = "0=101" Then %> <% Else %> No records found <% End If %> <% Else %> You do not have the right permission to view the page <% End If %> <% End If %>
<% '------------------------------------------------------------------------------- ' Function SetUpAdvancedSearch ' - Set up Advanced Search parameter based on querystring parameters from Advanced Search Page ' - Variables setup: sSrchAdvanced Sub SetUpAdvancedSearch() Dim arrFldOpr, arrFldOpr2, sSrchStr ' Field LakeNasserID sSrchStr = "" x_LakeNasserID = Request.QueryString("x_LakeNasserID") z_LakeNasserID = Request.QueryString("z_LakeNasserID") arrFldOpr = Split(z_LakeNasserID, ",") If x_LakeNasserID <> "" And IsNumeric(x_LakeNasserID) And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "`LakeNasserID` " & arrFldOpr(0) & " " & _ arrFldOpr(1) & AdjustSql(x_LakeNasserID) & arrFldOpr(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If ' Field LakeNasserName sSrchStr = "" x_LakeNasserName = Request.QueryString("x_LakeNasserName") z_LakeNasserName = Request.QueryString("z_LakeNasserName") arrFldOpr = Split(z_LakeNasserName, ",") If x_LakeNasserName <> "" And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "`LakeNasserName` " & arrFldOpr(0) & " " & _ arrFldOpr(1) & AdjustSql(x_LakeNasserName) & arrFldOpr(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If ' Field CruiseCategory sSrchStr = "" x_CruiseCategory = Request.QueryString("x_CruiseCategory") z_CruiseCategory = Request.QueryString("z_CruiseCategory") arrFldOpr = Split(z_CruiseCategory, ",") If x_CruiseCategory <> "" And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "`CruiseCategory` " & arrFldOpr(0) & " " & _ arrFldOpr(1) & AdjustSql(x_CruiseCategory) & arrFldOpr(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If ' Field CruiseItinerary sSrchStr = "" x_CruiseItinerary = Request.QueryString("x_CruiseItinerary") z_CruiseItinerary = Request.QueryString("z_CruiseItinerary") arrFldOpr = Split(z_CruiseItinerary, ",") If x_CruiseItinerary <> "" And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "`CruiseItinerary` " & arrFldOpr(0) & " " & _ arrFldOpr(1) & AdjustSql(x_CruiseItinerary) & arrFldOpr(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If ' Field CruiseDescription sSrchStr = "" x_CruiseDescription = Request.QueryString("x_CruiseDescription") z_CruiseDescription = Request.QueryString("z_CruiseDescription") arrFldOpr = Split(z_CruiseDescription, ",") If x_CruiseDescription <> "" And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "`CruiseDescription` " & arrFldOpr(0) & " " & _ arrFldOpr(1) & AdjustSql(x_CruiseDescription) & arrFldOpr(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If ' Field Cabinfacilities sSrchStr = "" x_Cabinfacilities = Request.QueryString("x_Cabinfacilities") z_Cabinfacilities = Request.QueryString("z_Cabinfacilities") arrFldOpr = Split(z_Cabinfacilities, ",") If x_Cabinfacilities <> "" And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "`Cabinfacilities` " & arrFldOpr(0) & " " & _ arrFldOpr(1) & AdjustSql(x_Cabinfacilities) & arrFldOpr(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If ' Field Cruisefacilities sSrchStr = "" x_Cruisefacilities = Request.QueryString("x_Cruisefacilities") z_Cruisefacilities = Request.QueryString("z_Cruisefacilities") arrFldOpr = Split(z_Cruisefacilities, ",") If x_Cruisefacilities <> "" And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "`Cruisefacilities` " & arrFldOpr(0) & " " & _ arrFldOpr(1) & AdjustSql(x_Cruisefacilities) & arrFldOpr(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If If sSrchAdvanced <> "" Then ' save settings Session(ewSessionTblAdvSrch & "_x_LakeNasserID") = x_LakeNasserID Session(ewSessionTblAdvSrch & "_x_LakeNasserName") = x_LakeNasserName Session(ewSessionTblAdvSrch & "_x_CruiseCategory") = x_CruiseCategory Session(ewSessionTblAdvSrch & "_x_CruiseItinerary") = x_CruiseItinerary Session(ewSessionTblAdvSrch & "_x_CruiseDescription") = x_CruiseDescription Session(ewSessionTblAdvSrch & "_x_Cabinfacilities") = x_Cabinfacilities Session(ewSessionTblAdvSrch & "_x_Cruisefacilities") = x_Cruisefacilities End If End Sub ' Function to check if the search operators are valid Function IsValidOpr(arOpr) Dim Opr IsValidOpr = IsArray(arOpr) If IsValidOpr Then IsValidOpr = (UBound(arOpr) >= 2) If IsValidOpr Then For Each Opr In arOpr Opr = UCase(Trim(Opr)) If Not (Opr = "=" Or Opr = "<" Or Opr = "<=" Or _ Opr = ">" Or Opr = ">=" Or Opr = "<>" Or _ Opr = "LIKE" Or Opr = "NOT LIKE" Or Opr = "BETWEEN" Or _ Opr = "'" Or Opr = "'%" Or Opr = "%'" Or Opr = "#" Or Opr = "") Then IsValidOpr = False Exit For End If Next End If End Function '------------------------------------------------------------------------------- ' Function BasicSearchSQL ' - Build WHERE clause for a keyword Function BasicSearchSQL(Keyword) Dim sKeyword sKeyword = AdjustSql(Keyword) BasicSearchSQL = "" BasicSearchSQL = BasicSearchSQL & "`LakeNasserName` LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "`CruiseCategory` LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "`CruiseItinerary` LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "`CruiseDescription` LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "`Cabinfacilities` LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "`Cruisefacilities` LIKE '%" & sKeyword & "%' OR " If Right(BasicSearchSQL, 4) = " OR " Then BasicSearchSQL = Left(BasicSearchSQL, Len(BasicSearchSQL)-4) End Function '------------------------------------------------------------------------------- ' Function SetUpBasicSearch ' - Set up Basic Search parameter based on form elements pSearch & pSearchType ' - Variables setup: sSrchBasic Sub SetUpBasicSearch() Dim arKeyword, sKeyword psearch = Request.QueryString(ewTblBasicSrch) psearchtype = Request.QueryString(ewTblBasicSrchType) If psearch <> "" Then If psearchtype <> "" Then While InStr(psearch, " ") > 0 sSearch = Replace(psearch, " ", " ") Wend arKeyword = Split(Trim(psearch), " ") For Each sKeyword In arKeyword sSrchBasic = sSrchBasic & "(" & BasicSearchSQL(sKeyword) & ") " & psearchtype & " " Next Else sSrchBasic = BasicSearchSQL(psearch) End If End If If Right(sSrchBasic, 4) = " OR " Then sSrchBasic = Left(sSrchBasic, Len(sSrchBasic)-4) If Right(sSrchBasic, 5) = " AND " Then sSrchBasic = Left(sSrchBasic, Len(sSrchBasic)-5) If psearch <> "" then Session(ewSessionTblBasicSrch) = psearch Session(ewSessionTblBasicSrchType) = psearchtype End If End Sub '------------------------------------------------------------------------------- ' Function ResetSearch ' - Clear all search parameters ' Sub ResetSearch() ' Clear search where sSrchWhere = "" Session(ewSessionTblSearchWhere) = sSrchWhere ' Clear advanced search parameters Session(ewSessionTblAdvSrch & "_x_LakeNasserID") = "" Session(ewSessionTblAdvSrch & "_x_LakeNasserName") = "" Session(ewSessionTblAdvSrch & "_x_CruiseCategory") = "" Session(ewSessionTblAdvSrch & "_x_CruiseItinerary") = "" Session(ewSessionTblAdvSrch & "_x_CruiseDescription") = "" Session(ewSessionTblAdvSrch & "_x_Cabinfacilities") = "" Session(ewSessionTblAdvSrch & "_x_Cruisefacilities") = "" Session(ewSessionTblBasicSrch) = "" Session(ewSessionTblBasicSrchType) = "" End Sub '------------------------------------------------------------------------------- ' Function RestoreSearch ' - Restore all search parameters ' Sub RestoreSearch() ' Restore advanced search settings x_LakeNasserID = Session(ewSessionTblAdvSrch & "_x_LakeNasserID") x_LakeNasserName = Session(ewSessionTblAdvSrch & "_x_LakeNasserName") x_CruiseCategory = Session(ewSessionTblAdvSrch & "_x_CruiseCategory") x_CruiseItinerary = Session(ewSessionTblAdvSrch & "_x_CruiseItinerary") x_CruiseDescription = Session(ewSessionTblAdvSrch & "_x_CruiseDescription") x_Cabinfacilities = Session(ewSessionTblAdvSrch & "_x_Cabinfacilities") x_Cruisefacilities = Session(ewSessionTblAdvSrch & "_x_Cruisefacilities") psearch = Session(ewSessionTblBasicSrch) psearchtype = Session(ewSessionTblBasicSrchType) End Sub '------------------------------------------------------------------------------- ' Function SetUpSortOrder ' - Set up Sort parameters based on Sort Links clicked ' - Variables setup: sOrderBy, Session(TblOrderBy), Session(Tbl_Field_Sort) Sub SetUpSortOrder() Dim sOrder, sSortField, sLastSort, sThisSort Dim bCtrl ' Check for an Order parameter If Request.QueryString("order").Count > 0 Then sOrder = Request.QueryString("order") ' Field `LakeNasserName` If sOrder = "LakeNasserName" Then sSortField = "`LakeNasserName`" sLastSort = Session(ewSessionTblSort & "_x_LakeNasserName") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_LakeNasserName") = sThisSort Else If Session(ewSessionTblSort & "_x_LakeNasserName") <> "" Then Session(ewSessionTblSort & "_x_LakeNasserName") = "" End If ' Field `CruiseCategory` If sOrder = "CruiseCategory" Then sSortField = "`CruiseCategory`" sLastSort = Session(ewSessionTblSort & "_x_CruiseCategory") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_CruiseCategory") = sThisSort Else If Session(ewSessionTblSort & "_x_CruiseCategory") <> "" Then Session(ewSessionTblSort & "_x_CruiseCategory") = "" End If Session(ewSessionTblOrderBy) = sSortField & " " & sThisSort Session(ewSessionTblStartRec) = 1 End If sOrderBy = Session(ewSessionTblOrderBy) If sOrderBy = "" Then If ewSqlOrderBy <> "" And ewSqlOrderBySessions <> "" Then sOrderBy = ewSqlOrderBy Session(ewSessionTblOrderBy) = sOrderBy Dim arOrderBy, i arOrderBy = Split(ewSqlOrderBySessions, ",") For i = 0 to UBound(arOrderBy)\2 Session(ewSessionTblSort & "_" & arOrderBy(i*2)) = arOrderBy(i*2+1) Next End If End If End Sub '------------------------------------------------------------------------------- ' Function SetUpStartRec ' - Set up Starting Record parameters based on Pager Navigation ' - Variables setup: nStartRec Sub SetUpStartRec() Dim nPageNo ' Check for a START parameter If Request.QueryString(ewTblStartRec).Count > 0 Then nStartRec = Request.QueryString(ewTblStartRec) Session(ewSessionTblStartRec) = nStartRec ElseIf Request.QueryString("pageno").Count > 0 Then nPageNo = Request.QueryString("pageno") If IsNumeric(nPageNo) Then nStartRec = (nPageNo-1)*nDisplayRecs+1 If nStartRec <= 0 Then nStartRec = 1 ElseIf nStartRec >= ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 Then nStartRec = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 End If Session(ewSessionTblStartRec) = nStartRec Else nStartRec = Session(ewSessionTblStartRec) End If Else nStartRec = Session(ewSessionTblStartRec) End If ' Check if correct start record counter If Not IsNumeric(nStartRec) Or nStartRec = "" Then ' Avoid invalid start record counter nStartRec = 1 ' Reset start record counter Session(ewSessionTblStartRec) = nStartRec ElseIf CLng(nStartRec) > CLng(nTotalRecs) Then ' Avoid starting record > total records nStartRec = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 ' point to last page first record Session(ewSessionTblStartRec) = nStartRec End If End Sub '------------------------------------------------------------------------------- ' Function ResetCmd ' - Clear list page parameters ' - RESET: reset search parameters ' - RESETALL: reset search & master/detail parameters ' - RESETSORT: reset sort parameters Sub ResetCmd() Dim sCmd ' Get Reset Cmd If Request.QueryString("cmd").Count > 0 Then sCmd = Request.QueryString("cmd") ' Reset Search Criteria If LCase(sCmd) = "reset" Then Call ResetSearch() ' Reset Search Criteria & Session Keys ElseIf LCase(sCmd) = "resetall" Then Call ResetSearch() ' Reset Sort Criteria ElseIf LCase(sCmd) = "resetsort" Then sOrderBy = "" Session(ewSessionTblOrderBy) = sOrderBy If Session(ewSessionTblSort & "_x_LakeNasserName") <> "" Then Session(ewSessionTblSort & "_x_LakeNasserName") = "" If Session(ewSessionTblSort & "_x_CruiseCategory") <> "" Then Session(ewSessionTblSort & "_x_CruiseCategory") = "" End If ' Reset Start Position (Reset Command) nStartRec = 1 Session(ewSessionTblStartRec) = nStartRec End If End Sub %>