%
Server.ScriptTimeOut = 600
If Request("ORDER") = "Yes" then
Session("NoOrder") = "No"
Dim RowNum
If not IsEmpty(Session("ProductList")) then
ProductList = Session("ProductList")
RowNum = Session("ProductNumber")
ProductList(1,RowNum) = 1
ProductList(2,RowNum) = Request("Part_Number")
ProductList(3,RowNum) = Request("Vendor")
ProductList(4,RowNum) = Request("Manu_Part")
ProductList(5,RowNum) = Request("Description")
ProductList(6,RowNum) = Request("Cost")
Session("ProductList") = ProductList
Session("ProductNumber")= Session("ProductNumber") + 1
Else
Dim ProductList(6,20)
ProductList(1,0) = 1
ProductList(2,0) = Request("Part_Number")
ProductList(3,0) = Request("Vendor")
ProductList(4,0) = Request("Manu_Part")
ProductList(5,0) = Request("Description")
ProductList(6,0) = Request("Cost")
Session("ProductList") = ProductList
Session("ProductNumber")= 1
End If
End If
'Database Content'
NeedRs = false
If not IsObject(Session("rsPRODUCTS")) or request("Query") = "Run Search" then
NeedRs = true
Else
Set rsPRODUCTS = Session("rsPRODUCTS")
End If
OrderBy = "'" & request("OrderBy") & "'"
if OrderBy <> "''" then
Query_String2 = Session("Query_String")
OrderBy =(" ORDER BY """ & Request("OrderBy") & """ ASC")
NeedRs = true
End If
Temp_Bookmark = "'" & Request("BookMark2") & "'"
If Temp_Bookmark <> "''" then
rsPRODUCTS.Bookmark = Session(Request("BookMark2"))
End If
If NeedRs then
Query_String=""
Manufacturer= "'" & Request("Manu_Part") & "'"
Part_Number = "'" & Request("Part_Num") & "'"
Description = "'" & Request("Description") & "'"
Cost = "'" & Request("Cost") & "'"
Category = "'" & Request("Category") & "'"
Vendor = "'" & Request("Vendor") & "'"
If Manufacturer <> "''" then
Query_String = " WHERE Manu_Part=" & Manufacturer
End If
If Description <> "''" then
If Query_String = "" then
Query_String = " WHERE Description LIKE " & Description
Else
Query_String = Query_String & " AND Description LIKE " & Description
End If
End If
If Category <> "''" then
If Query_String = "" then
Query_String = " WHERE Sub_Category=" & Category
Else
Query_String = Query_String & " AND Sub_Category=" & Category
End If
End If
If Cost <> "''" then
Operator = "="
If Instr(Cost,"<") then
Operator = "<"
Cost = RIGHT(Request("Cost"),LEN(Request("Cost"))- 1)
End If
If Instr(Cost,">") then
Operator = ">"
Cost = RIGHT(Request("Cost"),LEN(Request("Cost"))- 1)
End If
If Instr(Cost,"=") then
Operator = "="
Cost = RIGHT(Request("Cost"),LEN(Request("Cost"))- 1)
End If
If IsNumeric(Cost) then
If Query_String = "" then
Query_String = " WHERE Cost" & Operator & Cost
Else
Query_String = Query_String & " AND Cost" & Operator & Cost
End If
End If
End If
If Vendor <> "''" then
If Query_String = "" then
Query_String = " WHERE Vendor LIKE " & Vendor
Else
Query_String = Query_String & " AND Vendor LIKE " & Vendor
End If
End If
If Part_Number <> "''" then
Query_String = " WHERE Part_Num=" & Part_Number
End If
If Manufacturer <> "''" then
Query_String = " WHERE Manu_Part=" & Manufacturer
End If
Set PRODUCTS= Server.CreateObject("ADODB.Connection")
PRODUCTS.ConnectionTimeout = 240
PRODUCTS.CommandTimeout = 240
PRODUCTS.Open "DRIVER={SQL Server};SERVER=Pages;UID=sa;PWD=;APP=Microsoft (R) Developer Studio;DATABASE=PM_PRODUCTS",inetuser, zxcvbn
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set rsPRODUCTS= Server.CreateObject("ADODB.Recordset")
If OrderBy ="''" Then
Session("Query_String") = Query_String
cmdTemp.CommandText = ("SELECT * FROM ""PM_PRODUCTS"" " & Query_String)
Else
cmdTemp.CommandText = ("SELECT * FROM ""PM_PRODUCTS"" " & Query_String2 & OrderBy)
End If
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = PRODUCTS
rsPRODUCTS.Open cmdTemp, , 1, 3
Set Session("rsPRODUCTS") = rsPRODUCTS
Session("CurrentRecord") = 1
Session("CurrentPage") = 1
End If
On Error Resume Next
If rsPRODUCTS.BOF And rsPRODUCTS.EOF Then
response.redirect("products.asp?Status=1&What=" & Query_String )
Else
MoveHow = "'" & Trim(Request("MoveHow")) & "'"
if MoveHow <> "''" then
Select Case MoveHow
Case "'Search Again'"
Response.redirect("products.asp")
Case "'<<'"
rsPRODUCTS.AbsolutePage = 1
Session("CurrentRecord") = 1
Case "'<'"
If Session("CurrentRecord") <> 1 Then
rsPRODUCTS.MovePrevious
Session("CurrentRecord") = Session("CurrentRecord") - 1
End If
Case "'>'"
If Session("CurrentRecord") <> rsPRODUCTS.RecordCount Then
rsPRODUCTS.MoveNext
Session("CurrentRecord") = Session("CurrentRecord") + 1
End If
Case "'>>'"
rsPRODUCTS.AbsolutePage = rsPRODUCTS.PageCount
Session("CurrentRecord") = rsPRODUCTS.RecordCount
End Select
Else
If rsPRODUCTS.BOF then
rsPRODUCTS.MoveNext
Session("CurrentRecord") = 1
Session("CurrentPage") = 1
End If
End If
MoveHow2 = "'" & Trim(Request("MoveHow2")) & "'"
if MoveHow2 <> "''" then
Select Case MoveHow2
Case "'Search Again'"
Response.redirect("products.asp")
Case "'<<'"
rsPRODUCTS.AbsolutePage = 1
Session("CurrentPage") = 1
Case "'<'"
If Session("CurrentPage") <> 1 Then
rsPRODUCTS.AbsolutePage = rsPRODUCTS.AbsolutePage - 1
Session("CurrentPage") = Session("CurrentPage") - 1
End If
Case "'>'"
If Session("CurrentPage") <> rsPRODUCTS.PageCount Then
rsPRODUCTS.AbsolutePage = rsPRODUCTS.AbsolutePage + 1
Session("CurrentPage") = Session("CurrentPage") + 1
End If
Case "'>>'"
rsPRODUCTS.AbsolutePage = rsPRODUCTS.PageCount
Session("CurrentPage") = rsPRODUCTS.PageCount
End Select
End If
%>
PM SYSTEMS MAIN RESULTS PAGE
<%
'Session Variables
Session("MANUFACTURER#")= rsPRODUCTS("Manu_Part")
Session("PM#")= rsPRODUCTS("Part_Num")
Session("Cost")= rsPRODUCTS("Cost")
Session("DESCRIPTION")= rsPRODUCTS("Description")
%>
<%If Request("DataAction") <> "List" then%>
|
|
|
|
|
|
Product
Type: |
|
<%Response.write(rsPRODUCTS("Sub_Category"))%> |
|
Manufacturer: |
|
<%Response.write(rsPRODUCTS("Vendor"))%> |
|
Manufacturer's
Part # |
|
<%Response.write(rsPRODUCTS("Manu_Part"))%> |
|
PM
System's Part # |
|
<%Response.write(rsPRODUCTS("Part_Num"))%> |
|
Description: |
|
<%Response.write(" " & rsPRODUCTS("Description") & " ")%> |
|
Your
Cost: |
|
<%Response.write(FormatCurrency(rsPRODUCTS("Cost")))%> |
|
<%
'END of Form View'
Else
%>
<%Response.write(Session("CurrentPage") & "/" & rsPRODUCTS.pagecount)%>
<%End If%>
<%End If%>